Error while build apk - java

Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
java.io.IOException: Can't write [C:\Users\Akash\Desktop\android\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\Akash.gradle\caches\transforms-1\files-1.1\support-compat-25.2.0.aar\876e5d10a24579a64796f25edbd33794\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/v4/view/ViewCompat.class]))
App Gradle :
apply plugin: 'com.android.application'
android {`enter code here`
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.razorworld.bike"
minSdkVersion 14
targetSdkVersion 25
multiDexEnabled true
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets.main {
jni.srcDirs = []// <-- disable automatic ndk-build call
}
}
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.android.support:multidex:1.0.1')
}

Related

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:generateReleaseBuildConfig

Here is my build.gradel modul.app
PROBLEM org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:generateReleaseBuildConfig
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.packagename"
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
// Prevent OutOfMemory with MultiDex during the build phase
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets.main {
jni.srcDirs = []// <-- disable automatic ndk-build call
}
}
dependencies {
implementation 'com.google.android.gms:play-services:+'exclude module: 'support-v4'
implementation 'com.parse:parse-android:1.10.3'
implementation 'com.android.support:multidex:1.0.1'exclude module: 'support-v4'
implementation 'com.google.android.ads.consent:consent-library:1.0.3'
}
I get tired with this problem when i want to build this project to apk from buildbox by android studio

I have an error in my gradle:

I have an error in my gradle:
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
java.io.IOException: Can't write [C:\Users\El-Othmane\Desktop\tes11\android2\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\El-Othmane.gradle\caches\transforms-1\files-1.1\support-core-ui-26.1.0.aar\744d5e6087e939bc5d55ea9f4d6a237d\jars\classes.jar(;;;;;;**.class)]
(Duplicate zip entry [classes.jar:android/support/v4/view/ViewPager$2.class]))
enter code here Here is my gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.companyname.gamename"
minSdkVersion 14
targetSdkVersion 27
multiDexEnabled true
dexOptions {
javaMaxHeapSize "4g"
}
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
}
productFlavors {
}
}
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')
}
First add this library in Gradle:
compile 'com.android.support:multidex:1.0.0'
Also you can add multidex:
multiDexEnabled true
and make your application to extend class MultiDexApplication.
Put code like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.companyname.gamename"
minSdkVersion 16
targetSdkVersion 25
versionCode 4
versionName "1.3"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
defaultConfig {
multiDexEnabled true
}
useLibrary 'org.apache.http.legacy'
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'
}
}
dependencies {
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:support-v4:25.4.0'
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')
}
apply plugin: 'com.google.gms.google-services'
You are talking about how to exclude V4 See
Instead of V4 you can put V7 also like this
compile 'com.android.support:appcompat-v7:25.4.0'
You got this error may be because of Prograurd Duplicate zip entry
check below Links1 , Links2
Hope this solved your problem.
The error is expected because you're using an old support library which is conflicted with your compileSdkVersion and Google play service. So, you need to change your build.gradle to something like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
defaultConfig {
applicationId "com.companyname.gamename"
minSdkVersion 14
targetSdkVersion 27
multiDexEnabled true
dexOptions {
javaMaxHeapSize "4g"
}
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
}
productFlavors {
}
}
dependencies {
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
// Don't use the following
//compile files('libs/support-v4-19.0.1.jar')
// instead, use support library with the same version with your compileSdkVersion
compile 'com.android.support:support-v4:27.1.1'
// You should NOT use all the google play service
// use what you need, please refer to https://developers.google.com/android/guides/setup
compile 'com.google.android.gms:play-services:11.2.0'
}

android/support/v4/print/PrintHelper$PrintHelperStubImpl.class

I am not sure what this error means.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/print/PrintHelper$PrintHelperStubImpl.class
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.mygame"
minSdkVersion 14
targetSdkVersion 25
multiDexEnabled true
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets.main {
jni.srcDirs = []
}
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.android.support:multidex:1.0.1')
}

Error:(18, 0) Gradle DSL method not found: 'android()' compile

I am new to Android and Android Studio so, I downloaded a project that I also need for my class then I got this error. I could not find my answer here, although there was a question like mine. Please help me to run this program that I downloaded from internet and solve this error, thank you.
These are my gradles:
apply plugin: 'com.android.application'
android {
compileSdkVersion 17
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.gettaxi"
minSdkVersion 8
targetSdkVersion 17
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
}
And:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}
allprojects {
repositories {
jcenter()
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.stackoverflow.answer"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
androidTestCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
}

Can't compile app Error code 1

I'm trying to use the aacdecoder library to listen an online radio in my app, the thing is that it doesn't compile, I have added the jar library and added to the build.gradle, this is my code
MultiPlayer aacMp3Player = new MultiPlayer();
aacMp3Player.playAsync( "http://cast.direcnode.com:11413/stream" );
And this is the error:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Users/Ger/Documents/sdk/build-tools/android-4.4W/dx --dex --num-threads=4 --output /Users/Ger/Desktop/Radio/app/build/intermediates/dex/debug /Users/Ger/Desktop/Radio/app/build/intermediates/classes/debug /Users/Ger/Desktop/Radio/app/build/intermediates/dependency-cache/debug /Users/Ger/Desktop/Radio/app/build/intermediates/pre-dexed/debug/aacdecoder-android-0.8-470e8c408147266db0ce9215156fc542209cf849.jar
Error Code:
1
This is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "ger.radio"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile files('lib/aacdecoder-android-0.8.jar')
compile fileTree(dir: 'lib', include: ['*.jar'])
}
task copyNativeLibs(type: Copy) {
from(new File('libs')) { include '**' }
into new File(buildDir, 'native-libs')
}

Categories

Resources