I have imported a project from Eclipse into Android Studio 1.0.1 that consists in an Android Library Project (RuletaAfortunadaCore) and an Android Project (RuletaAfortunada), also have some third parties library dependencies. During the import everything seemed fine, but now when I try to build it I get this error message from Gradle:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ruletaAfortunadaCore:proguardRelease'.
> java.io.IOException: The output jar is empty. Did you specify the proper '-keep' options?
The whole output from the start of the building process:
Executing tasks: [clean, :ruletaAfortunada:compileDebugSources, :facebookSDK:compileDebugSources, :ruletaAfortunadaCore:compileDebugSources]
Configuration on demand is an incubating feature.
:facebookSDK:clean
:ruletaAfortunada:clean UP-TO-DATE
:ruletaAfortunadaCore:clean
:facebookSDK:compileLint
:facebookSDK:copyReleaseLint UP-TO-DATE
:facebookSDK:mergeReleaseProguardFiles UP-TO-DATE
:facebookSDK:preBuild
:facebookSDK:preReleaseBuild
:facebookSDK:checkReleaseManifest
:facebookSDK:prepareReleaseDependencies
:facebookSDK:compileReleaseAidl
:facebookSDK:compileReleaseRenderscript
:facebookSDK:generateReleaseBuildConfig
:facebookSDK:generateReleaseAssets UP-TO-DATE
:facebookSDK:mergeReleaseAssets
:facebookSDK:generateReleaseResValues UP-TO-DATE
:facebookSDK:generateReleaseResources
:facebookSDK:packageReleaseResources
:facebookSDK:processReleaseManifest
:facebookSDK:processReleaseResources
:facebookSDK:generateReleaseSources
:facebookSDK:compileReleaseJava
:facebookSDK:processReleaseJavaRes UP-TO-DATE
:facebookSDK:packageReleaseJar
:facebookSDK:compileReleaseNdk
:facebookSDK:packageReleaseJniLibs UP-TO-DATE
:facebookSDK:packageReleaseLocalJar
:facebookSDK:packageReleaseRenderscript UP-TO-DATE
:facebookSDK:bundleRelease
:ruletaAfortunada:preBuild
:ruletaAfortunada:preDebugBuild
:ruletaAfortunada:checkDebugManifest
:ruletaAfortunada:preReleaseBuild
:ruletaAfortunadaCore:compileLint
:ruletaAfortunadaCore:copyReleaseLint UP-TO-DATE
:ruletaAfortunadaCore:preBuild
:ruletaAfortunadaCore:preReleaseBuild
:ruletaAfortunadaCore:checkReleaseManifest
:ruletaAfortunadaCore:preDebugBuild
:ruletaAfortunadaCore:preDebugTestBuild
:ruletaAfortunadaCore:prepareComAndroidSupportSupportV42100Library
:ruletaAfortunadaCore:prepareComGoogleAndroidGmsPlayServices6587Library
:ruletaAfortunadaCore:prepareRuletaAfortunadaFacebookSDKUnspecifiedLibrary
:ruletaAfortunadaCore:prepareReleaseDependencies
:ruletaAfortunadaCore:compileReleaseAidl
:ruletaAfortunadaCore:compileReleaseRenderscript
:ruletaAfortunadaCore:generateReleaseBuildConfig
:ruletaAfortunadaCore:generateReleaseAssets UP-TO-DATE
:ruletaAfortunadaCore:mergeReleaseAssets
:ruletaAfortunadaCore:generateReleaseResValues UP-TO-DATE
:ruletaAfortunadaCore:generateReleaseResources
:ruletaAfortunadaCore:mergeReleaseResources
:ruletaAfortunadaCore:processReleaseManifest
:ruletaAfortunadaCore:processReleaseResources
:ruletaAfortunadaCore:generateReleaseSources
:ruletaAfortunadaCore:compileReleaseJava
:ruletaAfortunadaCore:extractReleaseAnnotations
:ruletaAfortunadaCore:mergeReleaseProguardFiles UP-TO-DATE
:ruletaAfortunadaCore:compileReleaseNdk
:ruletaAfortunadaCore:packageReleaseJniLibs UP-TO-DATE
:ruletaAfortunadaCore:packageReleaseRenderscript UP-TO-DATE
:ruletaAfortunadaCore:packageReleaseResources
:ruletaAfortunadaCore:proguardRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ruletaAfortunadaCore:proguardRelease'.
> java.io.IOException: The output jar is empty. Did you specify the proper '-keep' options?
The contents of the build.gradle file for such library project:
apply plugin: 'com.android.library'
android {
compileSdkVersion 13
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 9
targetSdkVersion 17
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile project(':facebookSDK')
compile 'com.android.support:support-v4:18.0.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.android.gms:play-services:+'
compile files('libs/chartboost.jar')
compile files('libs/mint-4.0.7.jar')
}
UPDATE: I have realized that the Android Library Project named RuletaAfortunadaCore can be build as an standalone project or made as a module without problems at all. It only fails to build when building the whole RuletaAfortunada Android Project that uses it.
The build.gradle file for such Android Project is the default one created by Android Studio, I think, so has nothing interesting inside. Anyway, here it is, just in case:
// 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:1.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
This is the settings.gradle:
include ':facebookSDK'
include ':ruletaAfortunadaCore'
include ':ruletaAfortunada'
And finally, just to have all of them, this is the facebookSDK module build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 9
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 9
targetSdkVersion 9
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile files('libs/bolts-android-1.1.2.jar')
}
As suggested by one guy which answer seem to have vanished now :-?, the solution for me has been to set minifyEnabled to false in the build.gradle of my Library Project. As far as I have it set as true for the Android Project itself, proguard will be executed anyway and the error have disappeared.
I've found some useful info here: http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0
One notable difference is that runProguard was changed to minifyEnabled.
However, after completing the steps from this migration topic, I still run into the same build error.
Related
I'm working on an Adnroid app that was imported. The imported app used an old version of Gradle so I'm trying to sync it to the new ones (it used Gradle 19 I think). I'm unable to use Gradle 24 b/c there are symbol class finders that can't be found, so I'm just trying to get this working with 21, but it still won't work. Can anyone help?
Here is my outer .build file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
allprojects {
repositories {
mavenCentral()
// maven { url 'http://clinker.47deg.com/nexus/content/groups/public' }
// maven { url 'http://repo1.maven.org/maven2' }
}
}
Here is my inner .build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.0.0"
defaultConfig {
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.android.support:support-v4:21.0.0'
compile 'com.android.support:appcompat-v7:21.0.0'
// compile "com.android.support:support-core-utils:21.0.0"
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'se.emilsjolander:stickylistheaders:2.5.2'
compile 'com.github.chrisbanes.photoview:library:1.2.2'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.google.android.gms:play-services:6.1.71'
}
When I run this on an physical android I get this error:
Executing tasks: [:leafsnap:clean, :leafsnap:generateDebugSources, :leafsnap:generateDebugAndroidTestSources, :leafsnap:mockableAndroidJar, :leafsnap:prepareDebugUnitTestDependencies, :leafsnap:assembleDebug]
Configuration on demand is an incubating feature.
Observed package id 'add-ons;addon-google_apis-google-24' in inconsistent location 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-24-1' (Expected 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-24')
Already observed package id 'add-ons;addon-google_apis-google-24' in 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-24'. Skipping duplicate at 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-24-1'
Incremental java compilation is an incubating feature.
:leafsnap:clean
:leafsnap:preBuild UP-TO-DATE
:leafsnap:preDebugBuild UP-TO-DATE
:leafsnap:checkDebugManifest
:leafsnap:preReleaseBuild UP-TO-DATE
:leafsnap:prepareComAndroidSupportAppcompatV72100Library
:leafsnap:prepareComAndroidSupportSupportV42100Library
:leafsnap:prepareComGoogleAndroidGmsPlayServices6171Library
:leafsnap:prepareSeEmilsjolanderStickylistheaders252Library
:leafsnap:prepareDebugDependencies
:leafsnap:compileDebugAidl
:leafsnap:compileDebugRenderscript
:leafsnap:generateDebugBuildConfig
:leafsnap:mergeDebugShaders
:leafsnap:compileDebugShaders
:leafsnap:generateDebugAssets
:leafsnap:mergeDebugAssets
:leafsnap:generateDebugResValues UP-TO-DATE
:leafsnap:generateDebugResources
:leafsnap:mergeDebugResources
:leafsnap:processDebugManifest
:leafsnap:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':leafsnap:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\build-tools\21.0.0\aapt.exe'' finished with non-zero exit value -1073741819
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
I can't figure out what's wrong with it. Can anyone help?
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
You're using gradle plugin 2.1.3 which according to documentation needs the following as must have dependencies.
Android Plugin for Gradle, Revision 2.1.3 (August 2016)
Dependencies:
Gradle 2.14.1 or higher.
Build Tools 23.0.2 or higher.
This update adds compatibility with Gradle 2.14.1, which includes performance improvements, new features, and an important security fix.
For more details, see the Gradle release notes.
whereas your build tool version currently set as buildToolsVersion "21.0.0".
Change the build tool version to 23.0.2, update the support and appcompat dependencies accordingly and sync again.
I have dell inspiron N4010 laptop with Intel Core i5 CPU M 480 # 2.67GHz, 4GB RAM, 500GB Hard disk running ubuntu 16.04LTS - 64bit OS. I have been developing Android Apps in Android Studio 1.5+ Version. Now migrated to Android Studio 2.1.2. Everything was smooth in previous versions of AS in my Laptop.
Building Apps in the latest version is too slow; takes 30seconds to 1.5 minutes to build - only while editing xml files. If I made any change in Java files, then build time went to 10 minutes.
So, I formatted the hard disk to ext4 and installed ubuntu 16.04(Single OS) - 500GB fully...
Downloaded and installed Android Studio 2.1.2 and Oracle jdk 8. Still it takes 10 minutes for every time I change any java files.
Here is my app(module) gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.0.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.gmail.balavickey1192"
minSdkVersion 16
targetSdkVersion 24
versionCode 300
versionName "2.0"
multiDexEnabled true
}
dexOptions {
incremental true
preDexLibraries true
javaMaxHeapSize "10g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url 'http://repo.brightcove.com/releases'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-auth:9.0.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.roughike:bottom-bar:1.4.0.1'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.brightcove.player:exoplayer:4.8.2'
}
Project level gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have tried to search from internet and found some solutions. Here is my gradle.properties file:
org.gradle.jvmargs=-Xmx11000m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.daemon=true
And also disabled few plugins:
CVS integration
Git
Github
Google cloud tools
Subversion Integration
Changed following settings to checked mark by File->Settings->Build,Execution,Deplyment--->
Global Gradle settings- offline work
Compiler- Compile independent modules
- Make project automatically
- command line options: --offline --profile --parallel
- Use in-process build
- Configure on demand
Instant run - unchecked(disabled) everything in that tab.
Still it is too slow... 8 to 10 minutes!
So decided to build via command line; closed every apps even android studio, firefox and everything.
./gradlew assembleDebug --profile -- offline
first time, it said subsequent builds will be faster. Now build time decreased to 3 to 4 minutes...
Here is the report generated while building:
:app 6m47.94s (total)
:app:transformClassesWithDexForDebug 4m7.32s
:app:packageDebug 1m24.23s
:app:mergeDebugJniLibFolders 21.533s UP-TO-DATE
:app:transformClassesWithMultidexlistForDebug 14.906s
:app:transformNative_libsWithMergeJniLibsForDebug 10.125s UP-TO-DATE
:app:compileDebugJavaWithJavac 9.781s
:app:validateDebugSigning 6.251s
:app:transformClassesWithJarMergingForDebug 4.309s
:app:transformResourcesWithMergeJavaResForDebug 3.707s UP-TO-DATE
:app:zipalignDebug 3.657s
:app:processDebugJavaRes 0.543s UP-TO-DATE
:app:mergeDebugResources 0.302s UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72400Library 0.146s UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2400Library 0.121s UP-TO-DATE
:app:processDebugManifest 0.076s UP-TO-DATE
:app:generateDebugBuildConfig 0.062s UP-TO-DATE
:app:processDebugResources 0.061s UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72400Library 0.054s UP-TO-DATE
:app:assembleDebug 0.051s Did No Work
:app:prepareComAndroidSupportMediarouterV72300Library 0.050s UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk4141Library 0.044s UP-TO-DATE
:app:prePackageMarkerForDebug 0.041s
:app:prepareComGoogleAndroidGmsPlayServicesAds900Library 0.041s UP-TO-DATE
Total Build Time 7m37.73s
Startup 6.695s
Settings and BuildSrc 0.738s
Loading Projects 0.533s
Configuring Projects 10.535s
Task Execution 6m47.94s
Here is my system monitor screen captured while building gradle via terminal:
The same project runs smoothly on another HP Laptop with same configurations(i5, 4GB RAM, 500GB HDD, ubuntu 16.04-64 bit OS), same tools: Android Studio 2.1.2, oracle jdk-8; takes only very few seconds to build and run on that machine.
But for mine, the whole system hangs; Can't do anything while building either from Android Studio or from terminal.
Please help me guys...
I am trying to fire up a task to copy the aar files (android libs) to a separate folder, but the task keeps getting triggered before the build starts.
I am using this answer but it does not work for me:
Is there a method in Gradle to execute some task after the build?
Here's my gradle:
def buildLibrary = true;
if (buildLibrary) {
apply plugin: 'com.android.library'
} else {
apply plugin: 'com.android.application'
}
apply plugin: 'io.fabric'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs 'libs' //this way we can find the .aar file in libs folder
}
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
if (!buildLibrary) {
applicationId "myapp.com.mysdk"
}
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
// Support libraries and widgets
compile 'com.android.support:support-v13:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:gridlayout-v7:23.1.1'
}
// Why this keeps getting called before the build starts????
task copyAARToCommonLibs(type: Copy) {
println 'calling copyAARToCommonLibs before libs are built!!!'
from('../build/outputs/aar') {
include '*-release.arr'
}
into '../MyOutput/libs'
println 'end of calling!!!'
}
build.finalizedBy(copyAARToCommonLibs)
// This did not work either
tasks.build.doLast(){
println 'This is never called!!!'
}
and the output from a clean build:
Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources]
Configuration on demand is an incubating feature.
Crashlytics was applied to an android-library project.
Android-library support is currently an incubating feature.
Contact support#fabric.io with any issues.
calling copyAARToCommonLibs before libs are built!!!
end of calling!!!
:clean UP-TO-DATE
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:preDebugUnitTestBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:preReleaseUnitTestBuild UP-TO-DATE
... a bunch of stuff
:app:generateDebugAndroidTestBuildConfig
:app:generateDebugAndroidTestAssets UP-TO-DATE
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:compileDebugAndroidTestJavaWithJavac
:app:compileDebugAndroidTestNdk UP-TO-DATE
:app:compileDebugAndroidTestSources
BUILD SUCCESSFUL
Total time: 13.157 secs
The print statements that you added to copyAARToCommonLibs are misleading you. Based on their position in the task definition they are being executed at configuration time independently of any inter-task dependency order. This is why the prints appear before the build process occurs (as the configuration is not dependent on the task dependencies).
Here is a simple example:
task blahTask() {
println "Configuring finalizer"
doLast {
println "Actually running finalizer"
}
}
task toFinalize() {
println "Configuring to finalize"
doLast {
println "Actually running thing to finalize"
}
}
toFinalize.finalizedBy(blahTask)
When I execute toFinalize the output is:
Configuring finalizer
Configuring to finalize
:app:toFinalize
Actually running thing to finalize
:app:blahTask
Actually running finalizer
BUILD SUCCESSFUL
As you can see the finalizer's configuration code is actually executed before the configuration code for the task to be finalized (i.e. independent of task dependencies) whereas the doLast code is running in the desired order.
As such, using the print statements in the way you have is not actually giving an indication of when the copy task is running.
Another thing to realize is that in your output (from what you showed) there are no :app:copyAARToCommonLibs statements indicating that the task is not actually being run (it is being configured, hence the prints). According to the task docs a finalizer task will not run if the task being finalized (in your case build) was up to date. Quote:
On the other hand, finalizer tasks are not executed if the finalized task didn't do any work, for example if it is considered up to date or if a dependent task fails.
I'm trying to add libraries from maven, specifically, Crouton library.
I can add it, Sync and use the Crouton object in my project, but when trying to run the app, i get this
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':timetable:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Program Files (x86)\Android\android-studio\sdk\build-tools\19.0.1\dx.bat --dex --output D:\Developer\TimeTable3\timetable\build\pre-dexed\debug\crouton-library-1.8.2-c968ce53b92080dec516373cec51e9993ca5051f.jar C:\Users\Shahar\.gradle\caches\modules-2\files-2.1\de.keyboardsurfer.android.widget\crouton-library\1.8.2\725b0873131748c8c1bf2e1a27465e5bea857ab3\crouton-library-1.8.2.jar
Error Code:
1
Output:
error:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: class name (de/keyboardsurfer/android/widget/crouton/Configuration$1) does not match path (release/de/keyboardsurfer/android/widget/crouton/Configuration$1.class)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:520)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:665)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
at com.android.dx.command.dexer.Main.access$600(Main.java:78)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
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)
...while parsing release/de/keyboardsurfer/android/widget/crouton/Configuration$1.class
EDIT: gradle file added
this is my gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 15
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:+'
compile 'com.google.android.gms:play-services:4.0.30'
compile 'de.keyboardsurfer.android.widget:crouton-library:1.8.2'
compile files('libs/ActiveAndroid.jar')
}
if i use all three without "de.keyboardsurfer.android.widget:crouton-library:1.8.2"
then it all works ok.
Yeah, the build was broken. I didn't notice it locally. But thanks to you it's fixed and deployed to maven central. Clear your cache to get the new build of 1.8.2.
It looks like the crouton library is mispackaged. If you examine its contents:
jar -tf /Users/sbarta/.gradle/caches/modules-2/files-2.1/de.keyboardsurfer.android.widget/crouton-library/1.8.2/725b0873131748c8c1bf2e1a27465e5bea857ab3/crouton-library-1.8.2.jar
META-INF/
META-INF/MANIFEST.MF
release/
release/de/
release/de/keyboardsurfer/
release/de/keyboardsurfer/android/
release/de/keyboardsurfer/android/widget/
release/de/keyboardsurfer/android/widget/crouton/
release/de/keyboardsurfer/android/widget/crouton/Configuration$1.class
release/de/keyboardsurfer/android/widget/crouton/Configuration$Builder.class
release/de/keyboardsurfer/android/widget/crouton/Configuration.class
release/de/keyboardsurfer/android/widget/crouton/Crouton.class
release/de/keyboardsurfer/android/widget/crouton/DefaultAnimationsBuilder.class
release/de/keyboardsurfer/android/widget/crouton/LifecycleCallback.class
release/de/keyboardsurfer/android/widget/crouton/Manager$1.class
release/de/keyboardsurfer/android/widget/crouton/Manager$Messages.class
release/de/keyboardsurfer/android/widget/crouton/Manager.class
release/de/keyboardsurfer/android/widget/crouton/Style$1.class
release/de/keyboardsurfer/android/widget/crouton/Style$Builder.class
release/de/keyboardsurfer/android/widget/crouton/Style.class
release/de/keyboardsurfer/mobile/
release/de/keyboardsurfer/mobile/app/
release/de/keyboardsurfer/mobile/app/android/
release/de/keyboardsurfer/mobile/app/android/widget/
release/de/keyboardsurfer/mobile/app/android/widget/crouton/
release/de/keyboardsurfer/mobile/app/android/widget/crouton/BuildConfig.class
Everything is inside a release directory, but based on the error message, Configuration$1.class is in the package de.keyboardsurfer.android.widget.crouton (without release). You can contact the library author, or you could disassemble the jar, pull everything inside the release directory one level up, and repackage it.
The packing is wrong for the library on maven repository. So by the time it is corrected by author you can use the this libary as module by downloading and adding it in your project structure .
The path is https://github.com/keyboardsurfer/Crouton
I have informed author Benjamin Weiss on Google plus regarding the same.
I noticed that running gradle assembleRelease calls upon an outdated ProGuard version as can be seen from the shell output:
$ gradle assembleRelease
Relying on packaging to define the extension of the main artifact has been \
deprecated and is scheduled to be removed in Gradle 2.0
:Foobar:preBuild UP-TO-DATE
:Foobar:preReleaseBuild UP-TO-DATE
:Foobar:preDebugBuild UP-TO-DATE
:Foobar:prepareComAndroidSupportAppcompatV71900Library UP-TO-DATE
:Foobar:prepareComGoogleAndroidGmsPlayServices3136Library UP-TO-DATE
:Foobar:prepareReleaseDependencies
:Foobar:compileReleaseAidl UP-TO-DATE
:Foobar:compileReleaseRenderscript UP-TO-DATE
:Foobar:generateReleaseBuildConfig UP-TO-DATE
:Foobar:mergeReleaseAssets UP-TO-DATE
:Foobar:mergeReleaseResources UP-TO-DATE
:Foobar:processReleaseManifest UP-TO-DATE
:Foobar:processReleaseResources UP-TO-DATE
:Foobar:generateReleaseSources UP-TO-DATE
:Foobar:compileRelease UP-TO-DATE
:Foobar:proguardRelease
ProGuard, version 4.9
The output seems up to date
:Foobar:dexRelease UP-TO-DATE
:Foobar:processReleaseJavaRes UP-TO-DATE
:Foobar:packageRelease UP-TO-DATE
:Foobar:assembleRelease UP-TO-DATE
BUILD SUCCESSFUL
Total time: 15.703 secs
I use the following configuration in my build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
}
buildTypes {
release {
runProguard true
proguardFile 'proguard-project.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:19.0.0'
compile 'com.android.support:support-v4:19.0.0'
compile 'com.google.android.gms:play-services:3.1.36'
}
How can I point gradle to a newer version of ProGuard which might be available from the PATH, e.g. /usr/local/bin/proguard?
An alternative solution is to reference the desired version as follows:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
classpath 'net.sf.proguard:proguard-gradle:4.10'
}
}
...
What is your setup?
The official Proguard doc shows how you can point to proguard in the build.gradle. See here
As per the Proguard manual you can do the below to point to a proguard binary,
buildscript {
repositories {
flatDir dirs: '/usr/local/java/proguard/lib'
}
dependencies {
classpath ':proguard'
}
}
I think this might cause problems with the proguard version that comes shipped with the android SDK. Not tried yet!!