Hello i have a problem and i need some help
i want to integrate facebook Sdk in my project to facebook ads to get installs and i got some errors
This is the error :
Error:Execution failed for task'
:app:transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry: android/support/v4/media/TransportPerformer.class
And this is my build.gradle code :
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.example.example"
minSdkVersion 15
targetSdkVersion 24
multiDexEnabled true
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets.main {
jni.srcDirs = []// <-- disable automatic ndk-build call}
}
`repositories {
mavenCentral()
}
dependencies {
compile('com.google.android.gms:play-services:+'){exclude module: 'support-v4'}
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/support-v4-19.0.1.jar')
compile 'com.facebook.android:facebook-android-sdk:[4,5)'}`
Have you tried to run './gradlew clean' in your project?
Related
Here is my gradle code
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
compileOptions.encoding = 'ISO-8859-1'
defaultConfig {
multiDexEnabled true
applicationId "com.mujihamzale.Ayat-AyatMerdu"
minSdkVersion 9
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'joda-time:joda-time:2.2'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile files('libs/libGoogleAnalyticsServices.jar')
}
But when running the application on android studio 2.1.3, I get the following error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/analytics/internal/Command$1.class
I have been for days to look for a solution, Please Could you tell me how to solve this problem?
I have an app module and a module that I'm using as a library -- I'm still making changes to the library, so it isn't precompiled. The library module has its own res folder, which I'd like to keep separate from the main app's res folder. I believe the only way to do this is to package the library as an aar before including it in the main app. It would be convenient if I could run a single Gradle build to package the library and include it. Is this possible?
gradle.build for app (which compiles "my-library"):
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.app.id"
minSdkVersion 18
targetSdkVersion 25
versionCode 5
versionName "1.4"
}
sourceSets {
main {
assets.srcDirs = [project.ext.ASSET_DIR]
}
}
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 project(':my-library')
}
gradle.build for my-library:
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
minSdkVersion 18
targetSdkVersion 25
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
It turns out that Android Studio is smart enough handle a library module with a res folder. My error was coming from a conflict in the Manifest files.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/pubnub/api/AbstractLogger.class
i am facing this error while building the gradle can anyone help me out.????
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "io.atlanticlab.pubnubmaptracker"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.pubnub:pubnub-android-debug:3.7.10'
compile 'com.pubnub:pubnub-android:3.7.10'
}
repositories {
mavenCentral()
}
I have am really stumped...
I have an Android Studio (version 1.4) project consisting of two modules - androidLVL and myApp. When I attempt to build the project (Build -> Rebuild Project) I get these messages:
:myApp:processDebugManifest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':myApp:processDebugManifest'.
> java.lang.NullPointerException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Previous answers to this question indicate the error can be caused by incompatible sdk version numbers in the gradle build files - but I can't figure out what the correct versions should be. I edited the build files, but to no avail. Can someone please help? Here are the two gradle build files:
androidLVL:
apply plugin: 'com.android.library'
android {
// compileSdkVersion 22
compileSdkVersion 'Google Inc.:Google APIs:8'
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 10
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
}
dependencies {
compile 'com.google.android.gms:play-services:4.2.42'
compile 'com.android.support:appcompat-v7:22.0.+'
}
myApp:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:8'
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.tomoreilly.myApp"
minSdkVersion 10
targetSdkVersion 22
compileSdkVersion 22
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard-android.txt', 'proguard-project.txt'
}
}
}
dependencies {
compile project(':androidLVL')
compile files('libs/acra-4.2.3.jar')
compile files('libs/htmllexer.jar')
// compile "com.android.support:appcompat-v7:21.0.3"
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-ads:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
}
(Re the error message suggestion to 'run with --stacktrace option' etc. - I do not know how to invoke these options from within Android Studio).
There are my actions:
1) Add file google-play-services.jar from sdk directory in "libs" directory in my project.
2) Add dependency "compile files('libs/google-play-services.jar')" in build.gradle in my project (not in solution).
Sync Project is complete succesfully, but after running application i see that error:
Execution failed for task ':TestMcSiRun:dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
D:\SDK\sdk\sdk\build-tools\19.0.2\dx.bat --dex --output C:\Users\MCSIMUSIC\AndroidStudioProjects\TestMcSiRun\TestMcSiRun\build\dex\debug C:\Users\MCSIMUSIC\AndroidStudioProjects\TestMcSiRun\TestMcSiRun\build\classes\debug C:\Users\MCSIMUSIC\AndroidStudioProjects\TestMcSiRun\TestMcSiRun\build\dependency-cache\debug C:\Users\MCSIMUSIC\AndroidStudioProjects\TestMcSiRun\TestMcSiRun\build\pre-dexed\debug\classes-2b5c8c8b2a23992eb9323b131861658b5a6c4592.jar C:\Users\MCSIMUSIC\AndroidStudioProjects\TestMcSiRun\TestMcSiRun\build\pre-dexed\debug\classes-442363482f1c8783c26a5e38b6ee593d3f54a067.jar C:\Users\MCSIMUSIC\AndroidStudioProjects\TestMcSiRun\TestMcSiRun\build\pre-dexed\debug\google-play-services-da249c1d3c777ecbc074adaa5e3cd781485d270c.jar C:\Users\MCSIMUSIC\AndroidStudioProjects\TestMcSiRun\TestMcSiRun\build\pre-dexed\debug\support-v4-18.0.0-00a4eeb2a43f491f4d8b1d7286b2ebe4b40b994e.jar
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
What do I do wrong?
my build.gradle:
apply plugin: 'android'
android {
compileSdkVersion 18
buildToolsVersion '19.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 15
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:18.0.+'
compile 'com.google.android.gms:play-services:4.0.30'
//compile files('libs/google-play-services.jar')
}
You have something like this:
dependencies {
compile 'com.google.android.gms:play-services:4.0.30'
compile files('libs/google-play-services.jar')
}
But that's including the library twice. It's sufficient to have just this:
dependencies {
compile 'com.google.android.gms:play-services:4.0.30'
}
It will compile correctly, and it will include the right library in your APK.