I am unable to generate a signed APK for my app, I am stuck with the error java.io.IOException Execution failed for task:'app:proguardRelease' I have what I think is a basic gradle file see below
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.okason.clients"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.api-client:google-api-client:1.19.0'
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.android.support:support-v4:21.0.0'
compile 'com.android.support:appcompat-v7:21.0.0'
}
The generated Proguard-rules.pro file is empty amd I have not touched the proguard-android.txt file in the SDK. I even tried to copy this file to the root of app to be the same location as the app.gradle file without success.
I tried to run this command gradlew.bat assembleRelease per this [SO Question][1] with success. Please can someone take a look and let me know what I am doing wrong. I have update the SDK and Android Studio to the latest versions.
I think Sir you can avoid the error without turning off the Proguard. Check this answer by Sir Eric Schlenz with regards to this issue. In order to just get to a point where the build would get through proguard, You have to add -dontwarn entries for packages it was complaining about to your proguard-project.txt file.
Solved the problem by setting minifyEnabled true to minifyEnabled false in the app.gradle file
Related
I am getting error after update to appcompat-v7:24.0.0-alpha1 on generating the signed apk.
Error:Error: Style Resource definition cycle: TextAppearance.AppCompat.Light.SearchResult.Title => TextAppearance.AppCompat.SearchResult.Title => TextAppearance.AppCompat.SearchResult.Title [ResourceCycle]
Temporary but Working Solution:
I was searching for the solution for about two days but I was unable to create signed apk, finally I found the answer on this thread: https://code.google.com/p/android/issues/detail?id=203407
Just put these 3 lines in your 'app' build.gradle file under android()
lintOptions {
checkReleaseBuilds false
abortOnError false
}
finally your build.gradle file will be like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '24.0.0 rc2'
defaultConfig {
applicationId "abc.xyz"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//Here the magic Begins
lintOptions {
checkReleaseBuilds false
abortOnError false
}
//Here the magic Ends
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('src/main/libs/YouTubeAndroidPlayerApi.jar')
compile 'de.greenrobot:greendao:2.1.0'
}
I hope this answer will help you. This will create your build, later when proper 24 support libraries release available, you have to change it properly.
Faced same issue, here's right fix for it.
Start your SDK Manager, goto Extras section, here you can see update for Support Library. Install it.
Then open build.gradle/app.gradle
change
compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
to
compile 'com.android.support:appcompat-v7:24.0.0-alpha2'
Problem solved! cheers.
https://code.google.com/p/android/issues/detail?id=203407
check it for more details...
paste it in your Gradle of your project
classpath 'com.android.tools.build:gradle:2.1.0-alpha1'
compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
compile 'com.android.support:design:24.0.0-alpha1'
compile 'com.android.support:support-v4:24.0.0-alpha1'
compile 'com.android.support:cardview-v7:24.0.0-alpha1'
Downgrade local maven repository for support libraries.
Reverting back to 26 solves my problems.
See https://code.google.com/p/android/issues/detail?id=203546#c10
From one day to the other I opened the Android project that I'm currently working on and I got this gradle error, also happens when I try to create a new project:
Gradle sync failed: Illegal UTF8 string in constant pool in class file com/android/build/gradle/tasks/RenderscriptCompile$_ConfigAction_execute_closure7
Also I noticed that the arrangement of all the app packages has changed to this configuration and it is not able to import AppCompactActivity:
Error print screen
I had been trying to find something on the web but so far I found nothing related to this specific case. I tried a few things myself but I think it only made it even worse..
Anyone out there that can help me?
Thanks!
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "my.app.*****.musicpad"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
}
For anyone facing this error i have solved it by deleting the temp files.
Control panel-->Java-->Settings-->delete files and restore defaults.
I am struggling to run a basic Mapsforge application. I have added all its required jar files to project and gradle. But i am not able to run application. Getting following error:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. > java.util.zip.ZipException: duplicate entry: org/mapsforge/map/reader/Way.class
Here is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "test.mapsforge"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile files('libs/mapsforge-core-0.5.1.jar')
compile files('libs/mapsforge-map-0.5.1.jar')
compile files('libs/mapsforge-map-android-0.5.1.jar')
compile files('libs/mapsforge-map-awt-0.5.1.jar')
compile files('libs/SwingMapViewer-0.5.1.jar')
}
Folder structure
I have tried adding multiDexEnabled true in gradle config but didnt worked
Is there a reason you need to multidex? The decencies seem somewhat scarce and unless they are packed with methods I don't see how you would get past the 65k method limit. I also don't see a dependency for compile 'com.android.support:multidex:1.0.0' Please check https://developer.android.com/tools/building/multidex.html or try not using ultidex. You also may need to extend MultiDexApplication instead of a regular Application. I think your issue is really a duplicate dependency and not aa dex limit. have you tried gradle :app:dependencies?
I face same error too. when I delete swing map viewer every thing work fine even without using multiDexEnabled true
I want to use this library in a project in Android Studio, so as mentioned in read me, I created new project in the Android Studio and added dependencies in build.gradle file inside the app folder as:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.mycompany.swipe_instagram"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.lorentzos.swipecards:library:1.0.8#aar'
}
Then when I sync I started getting this error as:
I have Searched on the google and stack overflow but can't find any appropriate solution.
I used your "build.gradle" file and it is working fine for me (both with and without "aar"). Could be something wrong with the cache. Try "File -> Invalidate Caches / Restart"). Another way to generate more error message detail is to try building the module from the command line and getting verbose output
gradle -info compileDebugSources
You'll get lots of output which should give you a hint as to what's going wrong
I am using Android Studio and created a new project, which created the standard "Hello world" mock.
My gradle.build file has the following contents:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.whatever.blabla"
minSdkVersion 19
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Even though I did not change anything, Gradle still fails when trying to build it with the error:
Failed to complete Gradle execution.
Cause:
A fatal exception has occurred. Program will exit.
First of all, is there any way of getting extra info about the problem? And secondly, why is this happening since I only created a standard project?
I had the same problem and could fix it by following solution provided in the below link -
https://code.google.com/p/android/issues/detail?id=67946
Though I am not sure how setting the maxheapsize has fixed the issue.