While Trying to implement Admobs in project I m facing the below issue during build apk process.
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/iid/zzc.class
build.gradle
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
defaultConfig {
// ...
multiDexEnabled true
}
dexOptions {
jumboMode true
}
compileSdkVersion 23
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "eazy.picsart"
minSdkVersion 16
targetSdkVersion 23
versionCode 2
versionName "2.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [appPackageName: "${applicationId}"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
/* compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}*/
/* 3) Exclude duplicate licenses */
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
pickFirst 'AndroidManifest.xml'
exclude 'com/google/android/gms/ads/AdActivity.class'
}
aaptOptions{
cruncherEnabled = false
}
}
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'
})
testCompile 'junit:junit:4.12'
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'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services-ads:11.0.1'
}
Related
Hy! I am having following problem in my Android project
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/net/compatibility/WebAddress.class
I Know this is because of conflict in dependencies. I looked into dependencies but not able to configure which dependencies causing this issue. I am pasting my gradle code bellow
Module 1 :
android {
//useLibrary 'org.apache.http.legacy'
compileSdkVersion Integer.parseInt(project.ANDROID_COMPILE_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
versionCode Integer.parseInt(project.VERSION_CODE)
versionName project.VERSION_NAME
minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK)
targetSdkVersion Integer.parseInt(project.ANDROID_TARGET_SDK_VERSION)
}`sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java']
res.srcDirs = ['res']
}
test {
java.srcDirs = ['src/test/java']
}
}`compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7` }
packagingOptions {
exclude 'META-INF/ASL2.0'
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/services/javax.annotation.processing.Processor'
}`lintOptions {
abortOnError false
}
checkstyle {
ignoreFailures = true
}
buildToolsVersion '25.0.3'`}`dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':webViewMarker')
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'com.squareup:otto:1.3.8'`}`
Module 2
apply plugin: 'com.android.library'`ext {
bintrayRepo = 'maven'
bintrayName = 'folioreader'
publishedGroupId = 'com.folioreader'
libraryName = 'WebViewMarker'
artifact = 'webViewMarker'
libraryDescription = 'An epub reader for Android'
siteUrl = 'https://github.com/FolioReader/FolioReader-Android'
gitUrl = 'https://github.com/FolioReader/FolioReader-Android.git'
libraryVersion = '0.2.5'
developerId = 'mobisystech'
developerName = 'Folio Reader'
developerEmail = 'mahavir#codetoart.com'
licenseName = 'FreeBSD License'
licenseUrl = 'https://en.wikipedia.org/wiki/FreeBSD_Documentation_License#License'
allLicenses = ["FreeBSD"]`}`android {
compileSdkVersion 19
buildToolsVersion '25.0.3'
defaultConfig {
versionCode Integer.parseInt(project.VERSION_CODE)
versionName project.VERSION_NAME
minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK)
targetSdkVersion Integer.parseInt(project.ANDROID_TARGET_SDK_VERSION)
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}`
}
apply from: '../folioreader/bintray/installv1.gradle'
apply from: '../folioreader/bintray/bintrayv1.gradle'
Main Module
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}`}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.ebook.stev_ebook"
minSdkVersion 16
targetSdkVersion 25
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/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':folioreader')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.8.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.apache.httpcomponents:httpmime:4.5.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.stripe:stripe-android:+'
compile('com.twitter.sdk.android:twitter:1.3.2#aar') {
transitive = true;
}
compile 'com.android.support:multidex:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.google.android.gms:play-services-plus:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
}
Please comment this
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
Try Rebuilding again. Since it's a third party library , there is a chance that it might be causing the trouble
It means you are using different version of support and all android libraries for example you are using support library version 25.0.1 in one module and version 22.2.1 in another and of course you should add just one of these library to your dependencies when you add one library in one module you should not add it to build.gradle file of second.
Solution : remove duplicate libraries.
I have generated my signed apk for product flavors, but when i try to install the apk in my device, it says "App not installed"
Here is my gradle file code :-
android {
compileSdkVersion 25
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.app.olivesync"
minSdkVersion 14
targetSdkVersion 25
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors{
main {
applicationId "com.app.olivesync"
}
resonance {
applicationId "com.app.resonance"
}
}
dependencies {
compile('com.fasterxml.jackson.core:jackson-annotations:2.2.2') {
exclude group: 'com.fasterxml.jackson.core'
}
compile('com.fasterxml.jackson.core:jackson-databind:2.2.3') {
exclude group: 'com.fasterxml.jackson.core'
}
compile('com.fasterxml.jackson.core:jackson-core:2.2.3') {
exclude group: 'com.fasterxml.jackson.core'
}
compile 'com.android.support:support-v4:25.3.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.roomorama:caldroid:3.0.1'
compile 'com.android.support:design:25.3.0'
compile 'com.google.android.gms:play-services-gcm:10.2.0'
compile 'com.microsoft.azure:notification-hubs-android-sdk:0.4#aar'
compile 'com.microsoft.azure:azure-notifications-handler:1.0.1#aar'
compile 'com.google.firebase:firebase-crash:10.2.0'
compile 'com.github.shell-software:fab:1.1.2'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.github.iammert:MaterialIntroView:1.6.0'}
repositories {
maven { url "https://jitpack.io" }
}
apply plugin: 'com.google.gms.google-services'
change your version and then try to build sign apk. Hope it will work.
My Gradle is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "jim.mp.offline"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:25.0.0'
compile('com.android.support:appcompat-v7:25.0.0') {
exclude module: 'support-v4'
}
compile files('libs/commons-io-2.4.jar')
compile files('libs/osmdroid-android-4.1.jar')
compile files('libs/slf4j-android-1.5.8.jar')
}
But when I run the project say me :
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/database/DatabaseUtilsCompat.class
My problem was solved :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "24.0.3"
repositories {
mavenCentral()
}
defaultConfig {
applicationId "jim.mp.offline"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile ('com.android.support:multidex:1.0.1'){
exclude module: 'support-v4'
}
compile 'com.android.support:support-v4:25.0.0'
compile('com.android.support:appcompat-v7:25.0.0') {
exclude module: 'support-v4'
}
compile('commons-io:commons-io:2.4') {
exclude module: 'support-v4'
}
compile('org.slf4j:slf4j-android:1.7.10') {
exclude module: 'support-v4'
}
compile('org.slf4j:slf4j-api:1.7.10') {
exclude module: 'support-v4'
}
compile files('libs/osmdroid-android-4.1.jar')
}
I am getting the following error when I try to run the application:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
Here is the Build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.manzoor.myapplication"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
preDexLibraries = false
}
android.packagingOptions {
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/INDEX.LIST'
exclude 'META-INF/io.netty.versions.properties'
exclude 'com.google.protobuf.AbstractMessageLite'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'com.google.cloud', name: 'google-cloud-pubsub', version: '0.4.0'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:multidex:1.0.1'
}
I have downloaded Kaltura SDK and integrated into my project, I got below error, but when I ran demo application, I could run it.
Error:Execution failed for task ':playerSDK:transformNative_libsWithSyncJniLibsForRelease'.
> java.io.FileNotFoundException: /Users/aaaa/AndroidWorkplace/MediaShare/playerSDK/build/intermediates/bundles/release/jni/lib/armeabi/libHLSPlayerSDK.so (No such file or directory)
This is my gradle file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
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 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.aaaa.testSample"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "0.1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
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/ASL2.0'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':playerSDK')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile ('org.apache.httpcomponents:httpmime:4.5'){
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#11sd') {
transitive = true;
}
compile files('libs/gson-2.2.4.jar')
}
Any support on this?