I just installed Android Studio, made a project and when the project was building I got this error in the gardle console:
Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources]
Configuration on demand is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportSupportV42301Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
Error: org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/home/krisitown/Programming/SDK/android-sdk-linux/build-tools/19.1.0/aapt''
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/home/krisitown/Programming/SDK/android-sdk-linux/build-tools/19.1.0/aapt''
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.585 secs
The only thing I did was change the
compile 'com.android.support:appcompat-v7:23.0.1'
in the dependencies because it was giving me an error, after some google-ing I came to the conclusion that it was giving me an error because in the previous line I had a plus sign (+) for the version
EDIT: Here is my build.gardle
// 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.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Have 2 of em:
apply plugin: 'com.android.application'
android {
compileSdkVersion 15
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "com.firstapp.krisitown.myapplication"
minSdkVersion 15
targetSdkVersion 15
versionCode 1
versionName "1.0"
}
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:appcompat-v7:23.0.1'
}
Okay, so apparently the issue was caused by the fact that I was running a 64-bit Ubuntu OS and I needed some extra packages, so in case anyone wonders here is the mystical line solver of this situation:
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6
I found the answer here, so props to the guy who answered it:
Error: Unable to run mksdcard SDK tool
Related
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
GRADLE CONSOLE OUTPUT:
Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2510Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72510Library UP-TO-DATE
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCompat2510Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUi2510Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUtils2510Library UP-TO-DATE
:app:prepareComAndroidSupportSupportFragment2510Library UP-TO-DATE
:app:prepareComAndroidSupportSupportMediaCompat2510Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42510Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2510Library UP-TO-DATE
:app:prepareComAndroidVolleyVolley100Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Can anyone help me in fixing this. I am new to android :(
I have added a screen shot of Android Manifest.
So far I have tried below steps to fix the issue. Still no help.
1) Clean Prjoect
2) Rebuild Project
3) File > Invalid Cache/Restart
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.theaquarious.myfavapp"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:25.1.0'
testCompile 'junit:junit:4.12'
compile 'com.mcxiaoke.volley:library:1.0.19'
}
This issue is now resolved. The error was raised due to the image file. I have changed the extension of an JPG image to PNG without using any editor. Due to this android studio started to throw the error. Thanks to everyone who tried to help me. If anyone needs more clarification on this, just comment.
This appears to be a bug in aquiring a lock in some Java thread. I see this on my Windows 7 PC starting recently. I have had success by simply running Task Manager and then killing the java.exe process. If I then try again, the build seems to work fine.
The error is because the names of the files that are saved in your Drawable folder can not be capitalized. Rename the file and leave everything in lowercase.
Don’t save drawable images in capital case and it should be png not jpg else it will throw an error : Execution failed for task ':app:mergeDebugResources'
I am very new to Android and due to some reason, I am getting following o/p in grade console. Not able to resolve. Can anyone give a suggestion to resolve this error?
Executing tasks: [clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugUnitTestSources, :app:compileDebugAndroidTestSources]
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
WARNING: Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (25.0.1) and test app (25.0.0) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
:clean UP-TO-DATE
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2501Library
:app:prepareComAndroidSupportAppcompatV72501Library
:app:prepareComAndroidSupportSupportCompat2501Library
:app:prepareComAndroidSupportSupportCoreUi2501Library
:app:prepareComAndroidSupportSupportCoreUtils2501Library
:app:prepareComAndroidSupportSupportFragment2501Library
:app:prepareComAndroidSupportSupportMediaCompat2501Library
:app:prepareComAndroidSupportSupportV42501Library
:app:prepareComAndroidSupportSupportVectorDrawable2501Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:mockableAndroidJar
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (25.0.1) and test app (25.0.0) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:prepareDebugAndroidTestDependencies'.
> Dependency Error. See console for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 8.644 secs
build.gradle(Project) contain the following data
// 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.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(app) contains the following:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.team.test"
minSdkVersion 9
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.+'
compile 'junit:junit:4.12'
}
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.
After update Android studio to Version 2.1.1, I try to run old project from existing source but project Can't build project
Error I can see is :
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\dev\ide\sdk\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1
in Gradle I have :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.example.app.prjname"
minSdkVersion 15
targetSdkVersion 23
versionCode 120
versionName "1.20"
}
signingConfigs {
release {
storeFile file("D:\\Android\\signkey\\Project\\prjname\\prjname.jks")
storePassword "mypassword"
keyAlias "prjnameAlias"
keyPassword "mypassword"
}
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// signingConfig signingConfigs.release
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.google.android.gms:play-services-maps:9.0.1'
compile 'com.github.satyan:sugar:1.4'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile files('libs/gcm.jar')
}
command-line options is empty
Gradle is not offline mode and set on use default gradle wraper
I try many solutions, clear Rebuild, Invalidate cache and restart
but not works
Message Gradle Build :
Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
Observed package id 'add-ons;addon-google_apis-google-19' in inconsistent location 'D:\dev\ide\sdk\add-ons\addon-google_apis-google-19-1' (Expected 'D:\dev\ide\sdk\add-ons\addon-google_apis-google-19')
Observed package id 'system-images;android-17;default;armeabi-v7a' in inconsistent location 'D:\dev\ide\sdk\system-images\android-17\armeabi-v7a' (Expected 'D:\dev\ide\sdk\system-images\android-17\default\armeabi-v7a')
Observed package id 'system-images;android-19;default;armeabi-v7a' in inconsistent location 'D:\dev\ide\sdk\system-images\android-19\armeabi-v7a' (Expected 'D:\dev\ide\sdk\system-images\android-19\default\armeabi-v7a')
:clean UP-TO-DATE
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2340Library
:app:prepareComAndroidSupportAppcompatV72340Library
:app:prepareComAndroidSupportDesign2340Library
:app:prepareComAndroidSupportRecyclerviewV72340Library
:app:prepareComAndroidSupportSupportV42340Library
:app:prepareComAndroidSupportSupportVectorDrawable2340Library
:app:prepareComGithubSatyanSugar14Library
:app:prepareComGoogleAndroidGmsPlayServicesBase901Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement901Library
:app:prepareComGoogleAndroidGmsPlayServicesMaps901Library
:app:prepareComGoogleAndroidGmsPlayServicesTasks901Library
:app:prepareComGoogleFirebaseFirebaseCommon901Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources FAILED
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\dev\ide\sdk\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 15.252 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
Try to build project form command line with gradlw assembleBuild :
Unzipping C:\Users\android\.gradle\wrapper\dists\gradle-2.10-all\5b6kqrscumh9p4e
vkkemdk57ad\gradle-2.10-all.zip to C:\Users\android\.gradle\wrapper\dists\gradle
-2.10-all\5b6kqrscumh9p4evkkemdk57ad
44> Configuring > 0/2 projects > root project > Resolving dependencies ':classpa
Observed package id 'add-ons;addon-google_apis-google-19' in inconsistent locati
on 'D:\dev\ide\sdk\add-ons\addon-google_apis-google-19-1' (Expected 'D:\dev\ide\
sdk\add-ons\addon-google_apis-google-19')
Observed package id 'system-images;android-17;default;armeabi-v7a' in inconsiste
nt location 'D:\dev\ide\sdk\system-images\android-17\armeabi-v7a' (Expected 'D:\
dev\ide\sdk\system-images\android-17\default\armeabi-v7a')
Observed package id 'system-images;android-19;default;armeabi-v7a' in inconsiste
nt location 'D:\dev\ide\sdk\system-images\android-19\armeabi-v7a' (Expected 'D:\
dev\ide\sdk\system-images\android-19\default\armeabi-v7a')
Incremental java compilation is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
Task 'assembleBuild' not found in root project 'prjname'.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option
to get the stack trace. Run with -
-info
or -
-debug
option to get more log output.
BUILD FAILED
Total time: 16 mins 5.454 secs
If you want to see error message, you can build project form command line with gradlw assembleBuild, it contains much more info.
1.Delete build folder inside from project
2.Clean Project
3.Rebuild Project
4.Run Project
This helps me so many times hope this will helps to you too.
I'm a rookie with OSX. Today I try to use RxJava and Retrolambda in Android Studio, Retrolambda needs gradle--retrolambda.
So I started config:
1.I pasted a little code to ~/.bash_profile to set the JAVA7_HOME and JAVA8_HOME
export JAVA7_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH
It seems work fine , I check it use terminal
echo $JAVA8_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
echo $JAVA7_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Then I following Others article
2.Edited Android Studio -> Preference -> Path Variables
Added "JAVA8_HOME" and "JAVA7_HOME" ,same as above
3.Edited build.gradle (Project)
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'me.tatarka:gradle-retrolambda:3.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
4.Edited build.gradle(app)
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda' #Added here!
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.ezioshiki.demoproject"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
#Added here!
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
#Added here!
String java8 = getJavaVersion(8)
String java7 = getJavaVersion(7)
retrolambda {
jdk java8 //have tried with JAVA8_HOME
oldJdk java7 //have tried with JAVA6_HOME
javaVersion JavaVersion.VERSION_1_7 //have matched the above with VERSION_1_6
}
String getJavaVersion(Integer v) {
def sout = new StringBuffer()
def proc = "/usr/libexec/java_home -v 1.$v".execute()
proc.consumeProcessOutput(sout, new StringBuffer())
proc.waitForOrKill(1000)
return sout.toString().replace("\n", "").replace("\r", "")
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'io.reactivex:rxjava:1.0.14'
compile 'net.orfjackal.retrolambda:retrolambda:2.0.6'
compile 'me.tatarka:gradle-retrolambda:3.2.2'
}
I followed https://github.com/evant/gradle-retrolambda/issues/61 , because gradle-retrolambda official suggestion cannot find Java8, and this issues worked.
But it gave me :
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileRetrolambdaDebug
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
at com.android.dx.command.dexer.Main.processClass(Main.java:752)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
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:672)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:574)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
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.parseClass(Main.java:764)
at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
at com.android.dx.command.dexer.Main.processClass(Main.java:749)
... 12 more
1 error; aborting
Error:Execution failed for task ':app:preDexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 2.143 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
I can't handle this. Anyone could help me ? Very very thank you :)
Try moving all .java files to the root package. That worked for me
This is how I have configured my OSx environment,
install latest java 8
edit your .bash_profile (located in your home directory) and add this lines:
export JAVA_HOME=/usr/libexec/java_home
export JAVA7_HOME=/usr/libexec/java_home -v 1.7
*now "java -version" command must shows java 1.8, but retrolambda can also access to java 7 home directory.
add these lines to your project build.gradle file:
dependencies {
...
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
apply retrolambda plugin to your android app module build.gradle:
apply plugin: 'me.tatarka.retrolambda'
*there is no need to add compile dependencies to this module.