After adding the Espresso test files I got the error. I tried many suggestions, nothing helped so far.
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/test/BuildConfig;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
The app build.gradle is:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keystore stuff ...
}
}
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId ...
minSdkVersion 16
targetSdkVersion 19
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'LICENSE.txt'
}
}
dependencies {
compile 'com.android.support:support-v4:22.1.0'
compile 'com.google.code.gson:gson:2.4'
compile 'joda-time:joda-time:2.0'
compile files('libs/commons-io-2.4.jar')
compile files('libs/commons-lang3-3.4.jar')
compile files('libs/exp4j-0.4.4.jar')
compile files('libs/GraphView-3.1.2.jar')
compile files('libs/mapsforge-map-0.3.1-SNAPSHOT-jar-with-dependencies.jar')
compile files('libs/osmbonuspack_v5.1.jar')
compile files('libs/osmdroid-android-4.3.jar')
compile files('libs/slf4j-android-1.5.8.jar')
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
compile 'com.android.support:support-annotations:22.2.0'
androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test:rules:0.3'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
}
allprojects {
repositories {
jcenter()
}
}
I tried many suggestions in this area, I hope you can help.
Based on the answer here and your config file, could you remove the following line from your gradle and give it a shot.
com.android.support.test:testing-support-lib:0.1
Related
I'm new to android, so please bear with me if my question is stupid.
I have an android project built in older version of gradle. The app works fine when modifying code in existing activities, but whenever I create a new activity, I get the following error:
Error:(77, 13) Failed to resolve: com.android.support.constraint:constraint-layout:1.0.2
Upgrade plugin to version 3.0.1 and sync project
Show in File
Show in Project Structure dialog
This is the content of app level gradle file:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias ''
keyPassword ''
storeFile file('')
storePassword ''
}
}
compileSdkVersion 27
buildToolsVersion "23.0.2"
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
defaultConfig {
applicationId ""
minSdkVersion 15
targetSdkVersion 22
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
jcenter()
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
incremental true
}
productFlavors {
}
}
dependencies {
//compile fileTree(include: ['*.jar'], dir: 'libs')
//Fast and simple data storage library for Android
// compile project(':squarecamera')
// compile 'com.github.boxme:squarecamera:1.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.6'
compile 'se.emilsjolander:stickylistheaders:2.7.0'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'io.paperdb:paperdb:0.9'
compile 'com.fabiendevos:nanotasks:1.1.0'
compile 'com.flipboard:bottomsheet-core:1.5.0'
compile 'com.flipboard:bottomsheet-commons:1.5.0'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.okhttp:okhttp:1.6.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:1.6.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-jackson:2.0.0-beta2'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile project(':squarecamera')
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
This is my project level gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
And my android studio version is 3.0.1.
When I update the plugin, I get a lot of compatibility issues.
Please help me resolve this. Thanks in advance!
I tried to build apk it comes out this. What should I do? Please help!!
I don't where is the problem. The project is fine when I build the project, but it come error when I build apk.
Error:Execution failed for
task':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
Here is the gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId 'com.androidbelieve.SeeDate'
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
useLibrary 'org.apache.http.legacy'
multiDexEnabled true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services-ads:10.0.1'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.support:support-v4:22.2.1'
compile 'it.neokree:MaterialNavigationDrawer:1.3.3'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.code.findbugs:jsr305:2.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.firebase:firebase-client-android:2.5.0'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.firebaseui:firebase-ui:0.6.0'
}
apply plugin: 'com.google.gms.google-services'
gradle project
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Did you tried Build/Clean Project in Android Studio Menu
Which dependency does the app:transformClassesWithJarMergingForDebug come from? Maybe you should modify that dependency's version number to be consistent with the major sdk version.
I'm quite a new Android developer. I' working on a project with a few other guys and we use GitHub to collaborate. The particular app that gives me an error doesn't run on any of the other guys phones, so I've been given the task to fix it. Here is the problem: when i run the app on my phone, it crashes... Here is the error:
java.lang.NoClassDefFoundError:
Failed resolution of: Lcom/crashlytics/android/Crashlytics;
and the second error on the logcat is:
java.lang.ClassNotFoundException:
Didn't find class "com.crashlytics.android.Crashlytics"
on path: DexPathList[[dex fil
e...
I tried searching online but the suggestion to enable Multidex in the gradle folder didn't seem to help.
Thanx
This is my gradle file...
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/gen_approx_cyrillic.txt'
}
defaultConfig {
applicationId "com.aftarobot.assocbuilder"
minSdkVersion 19
targetSdkVersion 24
versionCode 7
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:2.0.1'
resolutionStrategy.force 'org.hamcrest:hamcrest-core:1.3'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
// compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true;
}
// compile project(path: ':aftarobotbackend', configuration: 'android-endpoints')
// compile project(path: ':xbackend', configuration: 'android-endpoints')
compile project(':aftarobotlibrary')
compile 'com.google.code.findbugs:jsr305:2.0.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
testCompile 'junit:junit:4.10'
}
apply plugin: 'com.google.gms.google-services'
Hi guys thanx for contributing. I got it fixed. I ended up going to the master branch of GitHub and copying that version of the manifest and it worked. I didn't have to change anything in the gradle file
I have a android studio project contains two modules use same library (jsoup). When i compie app it will show
Error:Execution failed for task
':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files
copied in APK META-INF/maven/org.jsoup/jsoup/pom.xml File1:
C:\Users\G.gradle\caches\modules-2\files-2.1\org.jsoup\jsoup\1.8.2\64238922c4006c3d0a9951c4c03983ecc6a1e1a0\jsoup-1.8.2.jar
File2:
C:\Users\G\AndroidStudioProjects\twrb\app\build\intermediates\exploded-aar\twrb\webviewtimetablesearcher\unspecified\jars\classes.jar
The dependencies in build.gradle of two modules as show below.
dependencies {
compile 'org.jsoup:jsoup:1.8.2'
}
And this is build.gradle of app.
dependencies {
compile project(':moduleA')
compile project(':moduleB')
}
How to fix it?? Thanks.
This is my whole build.gradle of app
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.test.tmp"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/maven/org.jsoup/jsoup/pom.xml'
exclude 'org/jsoup/nodes/entities-base.properties'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.2.4'
}
}
// Required because retrolambda is on maven central
repositories {
mavenCentral()
}
apply plugin: 'com.android.application' //or apply plugin: 'java'
apply plugin: 'me.tatarka.retrolambda'
dependencies {
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'io.realm:realm-android:0.87.5'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'io.reactivex:rxjava:1.1.0'
compile 'com.jakewharton.rxbinding:rxbinding:0.4.0'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
testCompile 'junit:junit:4.12'
androidTestCompile 'junit:junit:4.12'
compile project(':moduleA')
compile project(':moduelB')
}
For resolve it you must add
android {
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
in build.gradle
I'm new to Gradle, and downloaded a project from a repository at work.
When I open the project, Gradle cannot sync.
Error:Could not find org.robobinding:codegen:0.8.9.
Searched in the following locations:
file:/C:/Users/Marcelo/AppData/Local/Android/sdk/extras/android/m2repository/org/robobinding/codegen/0.8.9/codegen-0.8.9.pom
file:/C:/Users/Marcelo/AppData/Local/Android/sdk/extras/android/m2repository/org/robobinding/codegen/0.8.9/codegen-0.8.9.jar
file:/C:/Users/Marcelo/AppData/Local/Android/sdk/extras/google/m2repository/org/robobinding/codegen/0.8.9/codegen-0.8.9.pom
file:/C:/Users/Marcelo/AppData/Local/Android/sdk/extras/google/m2repository/org/robobinding/codegen/0.8.9/codegen-0.8.9.jarRequired by:
GollogAndroidApp:gollog:unspecified
Acording to this log error, I guess that Gradle is not searching Robobinding online. I looked at work offline configuration of Gradle at Android Studion and is not checked.
Here is my gradle.build
buildscript {
repositories {
jcenter()
maven() {
name 'RoboBinding AspectJPlugin Maven Repository'
url "https://github.com/RoboBinding/RoboBinding-aspectj-plugin/raw/master/mavenRepo"
}
}
dependencies {
classpath 'org.robobinding:aspectj-plugin:0.8.4'
classpath 'com.android.tools.build:gradle:1.1.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.6'
}
}
apply plugin: 'com.android.application'
apply plugin: 'org.robobinding.android-aspectj'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
lintOptions{
ignoreWarnings true
}
defaultConfig {
applicationId "br.com.fake.fakeproject"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
productFlavors {
dev {
applicationId "br.com.edeploy.fake.fakeproject"
}
prod {
applicationId "br.com.edeploy.fake.fakeproject"
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
ext {
//robobindingVersion = 'latest.integration'
daggerVersion = '1.2.2'
robobindingVersion = '0.8.9'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'info.hoang8f:android-segmented:1.0.6'
compile 'com.android.support:support-v4:23.0.1'
compile 'net.danlew:android.joda:2.8.2'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile("org.robobinding:robobinding:$robobindingVersion:with-aop-and-dependencies") {
exclude group: 'com.google.guava', module: 'guava'
}
aspectPath("org.robobinding:robobinding:$robobindingVersion:with-aop-and-dependencies") {
exclude group: 'com.google.guava', module: 'guava'
}
apt "org.robobinding:codegen:$robobindingVersion"
compile 'com.google.auto.value:auto-value:1.1'
apt "com.squareup.dagger:dagger-compiler:$daggerVersion"
compile "com.squareup.dagger:dagger:$daggerVersion"
/*provided "org.glassfish:javax.annotation:10.0-b28"*/
testCompile "junit:junit:4.12"
testCompile "org.mockito:mockito-all:1.10.19"
}
I have Android and Google repository updated.
I'm using Android Studio 1.4
Tks!
You defined the repository only for your buildscript - not for the project - add this:
repositories {
jcenter()
}
on root level behind: apply plugin: 'com.neenbedankt.android-apt'