Error while mopub integartion - java

I am integrating MOPUB ADs in application. I am following MOPUB SDK integration steps from https://www.mopub.com/resources/docs/android-sdk-integration/android-getting-started/
After adding mopub-volley-1.1.0.jar, I got following error.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/mopub/volley/AuthFailureError.class
My build.gradle code is
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.1'
defaultConfig {
multiDexEnabled true
applicationId "com.mopubdemo.android"
minSdkVersion 16
targetSdkVersion 24
versionCode 27
versionName '2.05'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/plexus/components.xml'
}
}
dependencies {
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/FlurryAnalytics-6.2.0.jar')
compile files('libs/acra-4.6.1.jar')
compile project(':mopub-sdk:mopub-sdk-native-video')
compile project(':mopub-sdk:mopub-sdk-native-static')
compile project(':mopub-sdk:mopub-sdk-banner')
compile project(':mopub-sdk:mopub-sdk-rewardedvideo')
compile project(':mopub-sdk')
compile project(':mopub-sdk:mopub-sdk-interstitial')
androidTestCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.johnkil.android-robototextview:robototextview:2.4.2'
compile 'com.google.code.gson:gson:2.4'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0#aar'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0#aar'
compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0#aar'
compile 'org.ocpsoft.prettytime:prettytime:4.0.0.Final'
compile 'com.koushikdutta.ion:ion:2.1.6'
compile 'pub.devrel:easypermissions:0.1.5'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:support-annotations:24.1.1'
compile 'com.google.android.gms:play-services:10.2.1'
compile files('libs/mopub-volley-1.1.0.jar')
}

Remove this line and then sync
compile files('libs/mopub-volley-1.1.0.jar')

Related

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/iid/zzc.class

I am making an app in which can edit photos and videos.It also shares edited photos via timeline which is made using Recycler view and Card view.
I am having an error whenever I try to run my app in Android SDK 22 but it is working file in Android SDK 23 and above.
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/iid/zzc.class
It occurs also I am building apk.
Gradle File for my app
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.practice.android.moments"
minSdkVersion 18
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [appPackageName: "${applicationId}"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
jumboMode true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
/* 3)(Creative SDK) Exclude duplicate licenses */
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
//help
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
pickFirst 'AndroidManifest.xml'
}
}
repositories {
mavenCentral()
}
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.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.android.gms:play-services-auth:11.0.1'
compile 'com.google.firebase:firebase-core:11.0.1'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.google.firebase:firebase-auth:11.0.1'
compile 'com.google.firebase:firebase-database:11.0.1'
compile 'com.google.firebase:firebase-storage:11.0.1'
compile 'com.google.firebase:firebase-ads:11.0.1'
compile 'com.google.firebase:firebase-invites:11.0.1'
compile 'com.google.firebase:firebase-appindexing:11.0.1'
compile 'com.google.firebase:firebase-crash:11.0.1'
compile ('com.facebook.android:audience-network-sdk:4.11.0'){
exclude group: 'com.google.android.gms'
}
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.adobe.creativesdk.foundation:auth:0.9.1251'
compile 'com.adobe.creativesdk:image:4.8.4'
compile 'com.localytics.android:library:3.8.0'
testCompile 'junit:junit:4.12'}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'}
apply plugin: 'com.google.gms.google-services'
Can any one please help me...
Phone used for testing
Meizu M2 Note OS version 5.1 Lollipop API 22
Redmi Note 3 OS version 6.0.1 Marshmallow API 23
Samsung Note 5 OS version 7.0 Nougat API 24
In my case,this error occurs because I have two different version of google-play-service lib.
I remove one of them,bingo!
Try move this compile
compile 'com.google.android.gms:play-services-auth:11.0.1'

Duplicate files copied in APK META-INF/LICENSE error showing while trying to run test case

Errors log are below:
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/LICENSE File1:
C:\Users\MYPC.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.5\7bdb321e86724b16af6134a0fd22fec649eda971\httpmime-4.5.jar
File2:
C:\Users\MYPC.gradle\caches\modules-2\files-2.1\xerces\xercesImpl\2.11.0\9bb329db1cfc4e22462c9d6b43a8432f5850e92c\xercesImpl-2.11.0.jar
File3:
C:\Users\MYPC.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.6.0\a0990e2e812ac6639b6ce955c91b13228500476e\jackson-annotations-2.6.0.jar
Dependencies I'm using below:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example.xyz.testauto"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'junit:junit:4.12'
compile 'io.appium:java-client:3.3.0'
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'commons-lang:commons-lang:2.6'
compile 'com.google.code.gson:gson:2.5'
compile 'com.testdroid:testdroid-api:2.9'
testCompile 'org.mockito:mockito-core:1.10.19'
compile 'com.google.dagger:dagger:2.4'
annotationProcessor 'com.google.dagger:dagger-compiler:2.4'
configurations {
all*.exclude group: 'commons-logging', module: 'commons-logging'
}
}
How I can remove this error ?
You should add this in your build.gradle section
META-INF directory are recognized and interpreted by the Java 2
Platform to configure applications, extensions;
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
Then Clean-Rebuild-Run

SQLiteAssetHelper utils not found

I had another post earlier about my project having a class not found exception for IOUtils. I fixed that, and now my project is crashing again.
Previous post: Android class not found when running on some devices but not on others
Giving me this stack trace now:
java.lang.NoClassDefFoundError: com.readystatesoftware.sqliteasset.Utils
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.copyDatabaseFromAssets(SQLiteAssetHelper.java:455)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.createOrOpenDatabase(SQLiteAssetHelper.java:400)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getWritableDatabase(SQLiteAssetHelper.java:176)
at com.testing.data.AppDatabase.<init>(AppDatabase.java:87)
at com.testing.data.AppDatabase.getInstance(AppDatabase.java:70)
It works when I try to run it on my tablet, and it crashes when I try to run it on my phone:
Here is the setup:
Android versions:
`Phone: 4.4.2`
`Tablet: 5.1.1`
SDK Setup:
`compileSdkVersion: 25`
`minSdkVersion: 15`
`targetSdkVersion: 24`
Could there possibly something conflicting? Seems unlikely, but they are both Util classes that are not being found.
Grade as requested:
apply plugin: 'com.android.application'
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':volley')
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.maps.android:android-maps-utils:0.3.+'
compile 'com.qozix:tileview:2.2.3'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'org.twitter4j:twitter4j-core:4.0.4'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'info.hoang8f:android-segmented:1.0.5'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.testing.base"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
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'
}
}
repositories {
mavenCentral()
}

:app:transformClassesWithJarMergingForDebug FAILED (jsonpath not used)

I am getting the below error while compiling my android project for emulator v4.1.1. I am not able to generate an apk as well. Below is the error and my gradle file.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/objectweb/asm/AnnotationVisitor.class
apply plugin: 'com.android.application'
android {
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/BCKEY.DSA'
exclude 'AUTHORS'
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/BCKEY.SF'
pickFirst 'META-INF/maven/com.google.guava/guava/pom.properties'
pickFirst 'META-INF/maven/com.google.guava/guava/pom.xml'
pickFirst 'META-INF/maven/net.minidev/accessors-smart/pom.properties'
pickFirst 'META-INF/maven/net.minidev/accessors-smart/pom.xml'
}
signingConfigs {
config {
keyAlias '********'
keyPassword '********'
storeFile file('C:/Users/Prasang/Downloads/***/****.jks')
storePassword '********'
}
}
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.**********"
minSdkVersion 15
targetSdkVersion 23
versionCode 7
versionName "7.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
dexOptions {
incremental = true;
preDexLibraries = false
javaMaxHeapSize "4g"
}
repositories {
jcenter()
maven { url "https://jitpack.io" }
mavenCentral()}
dependencies {
// compile 'net.minidev:json-smart:2.2'
testCompile 'junit:junit:4.12'
compile files('libs/red5streaming.jar')
compile files('libs/mina-core-2.0.7.jar')
//compile 'fm.jiecao:jiecaovideoplayer:3.4'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile fileTree(include: ['*.java'], dir: 'libs')
compile fileTree(include: ['*.so'], dir: 'libs')
//compile files('libs/red5pro-1.0.2.jar')
// compile 'me.yifeiyuan.periscopelayout:library:1.0.0'
compile 'com.parse:parse-android:1.10.3'
compile 'com.miguelcatalan:materialsearchview:1.4.0'
//compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.4.0'
compile 'com.koushikdutta.ion:ion:2.+'
compile 'com.wrapp.floatlabelededittext:library:0.0.6'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.github.orangegangsters:swipy:1.2.1#aar'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.github.afollestad.material-dialogs:core:0.8.5.6#aar'
// compile 'com.android.support:support-v4:24.0.0'
compile 'com.github.rtoshiro.fullscreenvideoview:fullscreenvideoview:1.1.0'
compile 'org.apache.commons:commons-lang3:3.0'
compile 'com.github.jd-alexander:LikeButton:0.1.8'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.github.kanytu:android-parallax-recyclerview:v1.7'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:percent:23.2.0'
compile 'com.google.android.gms:play-services-ads:9.0.2'
compile 'com.google.android.gms:play-services-auth:9.0.2'
compile 'com.google.android.gms:play-services-gcm:9.0.2'
compile 'com.google.gms:google-services:2.0.0-alpha6'
}
apply plugin: 'com.google.gms.google-services'}
probably confict in google-play-services
remove this
compile 'com.google.android.gms:play-services:9.0.2'
and left only this part
compile 'com.google.android.gms:play-services-ads:9.0.2' compile
'com.google.android.gms:play-services-auth:9.0.2' compile
'com.google.android.gms:play-services-gcm:9.0.2'
Also try to clean/rebuild your project

Duplicate files copied in APK Error

First off, Ive researched the forms and found many topics covering this. However, I have attempted all options that I found and nothing seems to work. Here is the error:
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK org/codehaus/jackson/impl/VERSION.txt
File1: C:\Users\Austin\AndroidStudioProjects\Intelwatch\app\libs\jackson-core-asl-1.8.5.jar
File2: C:\Users\Austin\AndroidStudioProjects\Intelwatch\app\build\intermediates\exploded-aar\com.esri.arcgis.android\arcgis-android\10.2.7\jars\libs\jackson-core-1.9.5.jar
app build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.f0xcr4f7.intelwatch"
minSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions{
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LGPL2.1'
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'
exclude 'META-INF/VERSION'
exclude 'META-INF/VERSION.txt'
exclude 'META-INF/version.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar', '.so'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.esri.arcgis.android:arcgis-android:10.2.7'
compile files('libs/android-async-http-1.3.1.jar')
compile files('libs/jackson-core-asl-1.8.5.jar')
compile files('libs/jackson-mapper-asl-1.8.5.jar')
compile files('libs/KumulosAndroid.0.2.3.jar')
}

Categories

Resources