I am facing gradle sync error when I open the project - java

ERROR: Unable to find method
'org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V'.
I tried to upgrade and downgrade the Gradle but getting the same error
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.micutu.locatedriver"
minSdkVersion 14
targetSdkVersion 24
versionCode 7
versionName "1.6"
}
buildTypes {
debug {
debuggable true
}
release {
debuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'io.nlopez.smartlocation:library:3.2.5'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.google.android.gms:play-services-places:9.2.1'
compile 'com.google.android.gms:play-services-location:9.2.1'
compile 'com.google.code.gson:gson:2.3'
}

Related

Why android studio 3, show me this error?

somebody can tell me, why Android Studio 3.0.1, show me this error when make app?
Execution failed for task ':joy-android-game-gdx:transformDexArchiveWithExternalLibsDexMergerForDebugAndroidTest'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
The next attach *my build gradle**
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.websmithing.gpstracker"
minSdkVersion 15
targetSdkVersion 25
versionCode 15
versionName "4.0.5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.loopj.android:android-async-http:1.4.9'
}
the app compila when i delete this line:
compile 'com.android.support:appcompat-v7:25.0.0'
but the app after moment automatic close
Try
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.websmithing.gpstracker"
minSdkVersion 15
targetSdkVersion 25
versionCode 15
versionName "4.0.5"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.android.support:multidex:1.0.2'
}
Beside this, please review your dependency versions. They are not the latest versions and you might want to update them. Take care of the buildToolsVersion as well.

can't find referenced method boolean isInstantApp() in library class android.content.pm.PackageManager

I am getting two error while generating signed apk in android studio 3.
when i try to build it build successfully.
Please help how to resolve this error.
but when i try generate signed apk i get following errors.
Warning:com.google.android.gms.internal.zzbga: can't find referenced method 'boolean isInstantApp()' in library class android.content.pm.PackageManager
Warning:com.google.android.gms.internal.zzbgb: can't find referenced method 'boolean isInstantApp(java.lang.String)' in library class android.content.pm.PackageManager
following is my build.gradle file code.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.micropeda.sudoku"
minSdkVersion 15
targetSdkVersion 22
versionCode 20171216
versionName "2.4.1"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.android.gms:play-services-ads:11.6.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.google.android.instantapps:instantapps:1.1.0'
}
Resolved my self, i just update build.gradle file.
Here is my updated build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.1'
defaultConfig {
applicationId "com.micropeda.sudoku"
minSdkVersion 15
targetSdkVersion 26
versionCode 20171216
versionName "2.4.1"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.android.gms:play-services-ads:11.6.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.google.android.instantapps:instantapps:1.1.0'
}

Missing styles. Is the correct theme chosen for this layout, (can not resolve AppCombatActivity)

I need help because i build this project(from udacity course of android beginner)
its ok but when i clean it and reopen it shows an error related to my theme used. Please any help would be appreciated.
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.example.android.scorekeeper"
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.0.0'
}
Find the below lines in app/build.gradle file
compile 'com.android.support:appcompat-v7:23.3.0' // ensure this line is present
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:recyclerview-v7:23.1.1'

Java.exe error while building project in Android Studio

After creating a new project when I try to run the app it shows build failed error.
I searched for it on the internet, they say that it may be due to duplicate libraries of gradle or duplicate dependencies in gradle file, but it wasn't so In my case.
Here is my build.gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.naveenjain.ayusch"
minSdkVersion 14
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'
}
Try to delete this line:
compile fileTree(dir: 'libs', include: ['*.jar'])
Or you could set multiDexEnabled true:
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
and try again. Hope it helps.

Dagger 2: java.lang.NoSuchMethodError

Can't build project with Dagger 2 (Android Studio 1.3).
Step 1. Add dependencies to build.gradle
apt 'com.google.dagger:dagger-compiler:2.0'
compile 'com.google.dagger:dagger:2.0'
provided 'org.glassfish:javax.annotation:10.0-b28'
Full build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:design:22.2.+'
compile 'com.android.support:palette-v7:22.2.+'
compile 'com.afollestad:material-dialogs:0.7.8.1'
apt 'com.google.dagger:dagger-compiler:2.0'
compile 'com.google.dagger:dagger:2.0'
compile 'org.androidannotations:androidannotations:3.0.+'
compile 'org.androidannotations:androidannotations-api:3.0.+'
provided 'org.glassfish:javax.annotation:10.0-b28'
compile files('libs/gson-2.2.jar')
}
Step 2.
Just add annotation #Inject or #Module to code and get compile error.
Error:Execution failed for task ':app:compileDebugJava'.
java.lang.NoSuchMethodError: com.google.common.collect.Multimaps.filterKeys(Lcom/google/common/collect/SetMultimap;Lcom/google/common/base/Predicate;)Lcom/google/common/collect/SetMultimap;
Any ideas?
Update
I'm create new project.
build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
apt 'com.google.dagger:dagger-compiler:2.0'
compile 'com.google.dagger:dagger:2.0'
provided 'org.glassfish:javax.annotation:10.0-b28'
compile files('libs/gson-2.2.jar')
}
And it compile fine. When I add to libs guava-r07.jar I get like compile error. I think the problem relate with guava.
Solved
Remove guava-r07.jar from libs.
Add to build.gradle
compile 'com.google.guava:guava:13.0.1'

Categories

Resources