Error:cannot find symbol class RecyclerView - java

android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.hiii"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/bolts-android-1.2.1 - Copy.jar')
compile 'com.android.support:appcompat-v7:23.0.0'
}
I cannot use RecyclerView and Linearlayoutmanager .i have Tried to Compile the older version too but every time it comes with error Cannot resolve symbol'recyclerview'.please help me

You need to add also the v7 recyclerview library. Add this to the dependencies of your build.gradle:
compile 'com.android.support:recyclerview-v7:23.0.0'

Related

black activity giving error android studio

Just downloaded Android Studio 2.1.3.Every time it gives
error: cannot resolve symbol appcompatactivity,oncreate.Further it shows message "Error:A problem occurred configuring project ':app'.
Could not download junit.jar (junit:junit:4.12)
Could not get resource 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.jar'.
java.lang.NullPointerException (no error message)"
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.prateek.myapplication"
minSdkVersion 23
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
}
Try removing that line:
testCompile 'junit:junit:4.12'

java.exe finished with non-zero exit value 1 android studio

I'm trying to run my application but it is giving above mentioned error. Unable to find solution. Kindly help. Following is my Gradle code.
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.mabdullahali.trenditch"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
}
Add dexOptions in gradle.
Hope this will help you .let me know.
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.mabdullahali.trenditch"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
dexOptions {
incremental = true;
preDexLibraries = false
javaMaxHeapSize = "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
}
change the value
buildToolsVersion "24.0.0"
to
buildToolsVersion "23.0.1"
or installed Build Tool version seen in SDK Manager

I am using android studio 2.1.My default hello world app is running (emulator),but it is crashing when launching on a jelly bean device

apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.aman.myapplication"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
}

Error:(26, 17) Failed to resolve: junit:junit:4.12 android studio 1.5

well i can't figure it out i have tried every possible solution i found but nothing worked like this one
Error:(23, 17) Failed to resolve: junit:junit:4.12
the main difference between those two questions is my error is (26,17) and his is (23,17)
here is my build.glade code
apply plugin: 'com.android.application'
repositories {
maven { url 'http://repo1.maven.org/maven2' }
jcenter { url "http://jcenter.bintray.com/" }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.vaio.myapplication2"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}

Error: finished with non-zero exit value2

i've imported a module in my application. When i try to run it, console show me this error:
**Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2**
I've 2 gradle.
1st gradle (my application)
apply plugin: 'test.test.myapplication'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "alo.com.geoapp"
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile files('libs/gson-2.2.2.jar')
compile project(':sdktools')}
2nd gradle (module imported)
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/SKMaps.jar')
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.guava:guava:18.0'
compile 'joda-time:joda-time:2.4'}
i've already tried to update my jdk (from 7.* to 8.*), but not resolve.
thank you!
If you have more than 65k methods you should use multidex (http://developer.android.com/tools/building/multidex.html).
on your gradle:
multiDexEnabled true
To check if you have more than 65 methods you should use proguard feature, or more simply use this lib just to check how many methods https://github.com/KeepSafe/dexcount-gradle-plugin?utm_source=Android+Weekly&utm_campaign=553bcbfc02-Android_Weekly_174&utm_medium=email&utm_term=0_4eb677ad19-553bcbfc02-337295057
Your compilesdkversion and targetsdkversion are different update your Targetsdkversion and compilesdkversion same version
apply plugin: 'test.test.myapplication'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "alo.com.geoapp"
minSdkVersion 8
targetSdkVersion 21 //here
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies
{
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile files('libs/gson-2.2.2.jar')
compile project(':sdktools')
}

Categories