I have problems with adding Lucene 6.2.0 to my Android Studio 2.1.2 project. However, adding this library to IntelliJ IDEA is not a problem. I tried copying Lucene files to my libs folder and then adding jar files listed here as libraries (Right click => Add as library). Build.gradle was looking fine:
compile files('libs/lucene-6.2.0/queryparser/lucene-queryparser-6.2.0.jar')
compile files('libs/lucene-6.2.0/demo/lucene-demo-6.2.0.jar')
compile files('libs/lucene-6.2.0/core/lucene-core-6.2.0.jar')
compile files('libs/lucene-6.2.0/analysis/common/lucene-analyzers-common-6.2.0.jar')
Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2400Library
:app:prepareComAndroidSupportAppcompatV72400Library
:app:prepareComAndroidSupportCardviewV72340Library
:app:prepareComAndroidSupportCustomtabs2340Library
:app:prepareComAndroidSupportDesign2400Library
:app:prepareComAndroidSupportRecyclerviewV72400Library
:app:prepareComAndroidSupportSupportV42400Library
:app:prepareComAndroidSupportSupportVectorDrawable2400Library
:app:prepareComFacebookAndroidFacebookAndroidSdk4150Library
: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
:app:generateDebugSources
:app:mockableAndroidJar UP-TO-DATE
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:mergeDebugAndroidTestShaders
:app:compileDebugAndroidTestShaders
:app:generateDebugAndroidTestAssets
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: C:\Users\Tomek\AndroidStudioProjects\UniversalSoundboard\app\src\main\java\com\tomaszstankowski\universalsoundboard\adapters\SoundListAdapter.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\Tomek\AndroidStudioProjects\UniversalSoundboard\app\src\main\java\com\tomaszstankowski\universalsoundboard\custom\singletons\SoundBank.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:buildInfoDebugLoader
:app:transformClassesWithExtractJarsForDebug
:app:transformClassesWithInstantRunVerifierForDebug
:app:transformClassesWithJavaResourcesVerifierForDebug
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug
:app:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug
:app:transformClassesWithInstantRunForDebug
:app:transformClasses_enhancedWithInstant+reloadDexForDebug
:app:incrementalDebugTasks
:app:prePackageMarkerForDebug
:app:fastDeployDebugExtractor
:app:generateDebugInstantRunAppInfo
:app:coldswapKickerDebug
:app:transformClassesWithInstantRunSlicerForDebug
:app:transformClassesWithDexForDebug
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
Error:PARSE ERROR:
Error:unsupported class file version 52.0
Error:...while parsing org/apache/lucene/analysis/ar/ArabicAnalyzer.class
Error:1 error; aborting
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_73\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 40.184 secs
Information:5 errors
Information:0 warnings
Information:See complete output in console
Tried adding these libraries as Dependencies from Maven Central but the result was the same as above.
Error:unsupported class file version 52.0
Error:...while parsing org/apache/lucene/analysis/ar/ArabicAnalyzer.class
I also tried this way:
compile fileTree(dir: 'libs', include: '*.jar')
My app ran without any errors but Lucene classes were not recognized.
What I'm doing wrong?
Problem seems to be solved now.
Error:unsupported class file version 52.0
Means that library was written in Java 8 (version 52.0) and android API still doesn't support Java 8 strongly enough to use such libraries even if you have selected JDK 1.8+ in your Android Studio project settings. Correct me if I'm wrong.
Related
I have just set up a new computer with Android Studio and imported my project from bitbucket.
Problem is that I am now getting this error when trying to build the project:
Information:Gradle tasks [:app:clean, :app:generateDebugSources,
:app:generateDebugAndroidTestSources, :app:mockableAndroidJar,
:app:prepareDebugUnitTestDependencies, :app:assembleDebug] :app:clean
:app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE
:app:prepareChAcraAcra470Library
:app:prepareComAndroidSupportAnimatedVectorDrawable2420Library
:app:prepareComAndroidSupportAppcompatV72420Library
:app:prepareComAndroidSupportDesign2420Library
:app:prepareComAndroidSupportRecyclerviewV72420Library
:app:prepareComAndroidSupportSupportCompat2420Library
:app:prepareComAndroidSupportSupportCoreUi2420Library
:app:prepareComAndroidSupportSupportCoreUtils2420Library
:app:prepareComAndroidSupportSupportFragment2420Library
:app:prepareComAndroidSupportSupportMediaCompat2420Library
:app:prepareComAndroidSupportSupportV132420Library
:app:prepareComAndroidSupportSupportV42420Library
:app:prepareComAndroidSupportSupportVectorDrawable2420Library
:app:prepareComGoogleAndroidGmsPlayServicesBase940Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement940Library
:app:prepareComGoogleAndroidGmsPlayServicesTasks940Library
:app:prepareComGoogleAndroidGmsPlayServicesVision940Library
:app:prepareComJourneyappsZxingAndroidEmbedded320Library
: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 :app:generateDebugSources
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl :app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:mergeDebugAndroidTestShaders :app:compileDebugAndroidTestShaders
:app:generateDebugAndroidTestAssets :app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources :app:mockableAndroidJar
UP-TO-DATE :app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac :app:compileDebugJavaWithJavac - is not
incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API. Note:
Recompile with -Xlint:deprecation for details. Note: Some input files
use unchecked or unsafe operations. Note: Recompile with
-Xlint:unchecked for details. :app:compileDebugNdk UP-TO-DATE :app:compileDebugSources :app:buildInfoDebugLoader
:app:transformClassesWithExtractJarsForDebug
:app:transformClassesWithInstantRunVerifierForDebug
:app:transformClassesWithJavaResourcesVerifierForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug
:app:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug
UP-TO-DATE :app:transformClassesWithInstantRunForDebug
:app:transformClasses_enhancedWithInstant+reloadDexForDebug UP-TO-DATE
:app:incrementalDebugTasks :app:prePackageMarkerForDebug
:app:fastDeployDebugExtractor :app:generateDebugInstantRunAppInfo
:app:coldswapKickerDebug
:app:transformClassesWithInstantRunSlicerForDebug
:app:transformClassesWithDexForDebug Error:Uncaught translation error:
com.android.dx.cf.code.SimException: local 0001: invalid Error:1
error; aborting Error:Execution failed for task
':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException:
com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException: Return code 1 for dex
process Information:BUILD FAILED Information:Total time: 1 mins 38.347
secs Information:3 errors Information:0 warnings Information:See
complete output in console
And here is the output from the Gradle Console window:
Executing tasks: [:app:clean, :app:generateDebugSources,
:app:generateDebugAndroidTestSources, :app:mockableAndroidJar,
:app:prepareDebugUnitTestDependencies, :app:assembleDebug]
Configuration on demand is an incubating feature. Incremental java
compilation is an incubating feature. :app:clean :app:preBuild
UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE :app:prepareChAcraAcra470Library
:app:prepareComAndroidSupportAnimatedVectorDrawable2420Library
:app:prepareComAndroidSupportAppcompatV72420Library
:app:prepareComAndroidSupportDesign2420Library
:app:prepareComAndroidSupportRecyclerviewV72420Library
:app:prepareComAndroidSupportSupportCompat2420Library
:app:prepareComAndroidSupportSupportCoreUi2420Library
:app:prepareComAndroidSupportSupportCoreUtils2420Library
:app:prepareComAndroidSupportSupportFragment2420Library
:app:prepareComAndroidSupportSupportMediaCompat2420Library
:app:prepareComAndroidSupportSupportV132420Library
:app:prepareComAndroidSupportSupportV42420Library
:app:prepareComAndroidSupportSupportVectorDrawable2420Library
:app:prepareComGoogleAndroidGmsPlayServicesBase940Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement940Library
:app:prepareComGoogleAndroidGmsPlayServicesTasks940Library
:app:prepareComGoogleAndroidGmsPlayServicesVision940Library
:app:prepareComJourneyappsZxingAndroidEmbedded320Library
: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 :app:generateDebugSources
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl :app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:mergeDebugAndroidTestShaders :app:compileDebugAndroidTestShaders
:app:generateDebugAndroidTestAssets :app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources :app:mockableAndroidJar
UP-TO-DATE :app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac :app:compileDebugJavaWithJavac - is not
incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API. Note:
Recompile with -Xlint:deprecation for details. Note: Some input files
use unchecked or unsafe operations. Note: Recompile with
-Xlint:unchecked for details.
:app:compileDebugNdk UP-TO-DATE :app:compileDebugSources
:app:buildInfoDebugLoader :app:transformClassesWithExtractJarsForDebug
:app:transformClassesWithInstantRunVerifierForDebug
:app:transformClassesWithJavaResourcesVerifierForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug
:app:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug
UP-TO-DATE :app:transformClassesWithInstantRunForDebug
:app:transformClasses_enhancedWithInstant+reloadDexForDebug UP-TO-DATE
:app:incrementalDebugTasks :app:prePackageMarkerForDebug
:app:fastDeployDebugExtractor :app:generateDebugInstantRunAppInfo
:app:coldswapKickerDebug
:app:transformClassesWithInstantRunSlicerForDebug
:app:transformClassesWithDexForDebug AGPBI:
{"kind":"error","text":"Uncaught translation error:
com.android.dx.cf.code.SimException: local 0001:
invalid","sources":[{}]} AGPBI: {"kind":"error","text":"1 error;
aborting","sources":[{}]}
FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException:
com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException: Return code 1 for dex
process
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
To investigate, I have created the Camera2Basic sample project that comes with Android Studio and that builds fine, so maybe this is a problem with a setting within my project rather than a general configuration/setup problem?
What I've already tried (with no luck):
Added org.gradle.jvmargs=-Xmx2048m to my gradle.properties file.
Setting minifyEnabled false in my app build.gradle file (in the release and in the debug blocks).
This suggestion.
File > Invalidate Cahces / Restart...
NB - Similar question here - but with a different error number and, currently, no answers.
Update:
Having removed a third party library (nxpnfclib.jar) from my app, my project now builds and runs fine. But if I then try re-adding the jar, the problem comes back.
Update #2:
I have created one of the sample Android Studio projects (Camera2Basic) and added the nxpnfclib.jar library. The same problem occurs. So this is clearly a problem with the nxpnfclib.jar library. (I have, today, emailed NXP about this latest issue with their library, so I will update this page with their solution - unless they update it, of course.)
I am using:
Windows 7 (64-bit)
Android Studio v2.1.3 (as a fresh install)
JDK 1.8.0_102
Gradle version 2.14.1
Android plugin version 2.1.3
This what I did to fix in my scenario:
At the project level on android studio updated the build.gradle like this:
buildscript {
ext.kotlin_version = '1.2.31
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
}
Then on the gradle-wrapper.properties this:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Error like this
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk420Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable840Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders 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:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac
Note: C:\Users\rockstar\Desktop\AstroMaze\app\src\main\java\com\org\astromaze\MainActivityUsers.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Incremental compilation of 6 classes completed in 2.053 secs.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:prePackageMarkerForDebug
:app:transformClassesWithDexForDebug
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
Error:The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_91\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 17.268 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console
Basically Your errors are :-
1) Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
2) Error:The number of method references in a .dex file cannot exceed 64K.
Solutions to these errors are as follows :-
1) add multiDexEnabled true line in your build.gradle(Module:app) inside defaultConfig
2) Replace the whole content of gradle.properties file with below :-
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
3) Go to Help > Edit Custom VM Options , if the file with extension .vmoptions opens then replace content of the file with the below content , if the file is not there then create one and then replace the content with this :-
# custom Android Studio VM options
#
# *DO NOT* modify this file directly. If there is a value that you would like to override,
# please add it to your user specific configuration file.
#
# See http://tools.android.com/tech-docs/configuration
#
-Xms256m
-Xmx750m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-da
-Djna.nosys=true
-Djna.boot.library.path=
-Djna.debug_load=true
-Djna.debug_load.jna=true
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-Didea.paths.selector=AndroidStudio2.1
-Didea.platform.prefix=AndroidStudio
All your errors will be resolved .
Good Luck .
Information:Gradle tasks [:app:assembleRelease]
Observed package id 'add-ons;addon-google_apis-google-19' in inconsistent location 'E:\adt-bundle-windows-x86-20140702\sdk\add-ons\addon-google_apis-google-19-1' (Expected 'E:\adt-bundle-windows-x86-20140702\sdk\add-ons\addon-google_apis-google-19')
Observed package id 'add-ons;addon-google_gdk-google-19' in inconsistent location 'E:\adt-bundle-windows-x86-20140702\sdk\add-ons\addon-google_gdk-google-19-1' (Expected 'E:\adt-bundle-windows-x86-20140702\sdk\add-ons\addon-google_gdk-google-19')
Observed package id 'build-tools;20.0.0' in inconsistent location 'E:\adt-bundle-windows-x86-20140702\sdk\build-tools\android-4.4W' (Expected 'E:\adt-bundle-windows-x86-20140702\sdk\build-tools\20.0.0')
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2330Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72330Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72330Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2330Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72330Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42330Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2330Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl
:app:compileReleaseRenderscript
:app:generateReleaseBuildConfig
:app:mergeReleaseShaders
:app:compileReleaseShaders
:app:generateReleaseAssets
:app:mergeReleaseAssets
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources
:app:mergeReleaseResources
:app:processReleaseManifest
:app:processReleaseResources
:app:generateReleaseSources
:app:incrementalReleaseJavaCompilationSafeguard
:app:compileReleaseJavaWithJavac
:app:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources
:app:lintVitalRelease
:app:prePackageMarkerForRelease
:app:transformClassesWithDexForRelease
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
:app:transformClassesWithDexForRelease FAILED
Error:Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 2
Executing tasks: [:app:clean, :app:generateDebugSources,
:app:generateDebugAndroidTestSources,
:app:prepareDebugUnitTestDependencies, :app:mockableAndroidJar,
:app:assembleDebug]
Parallel execution with configuration on demand is an incubating
feature. Incremental java compilation is an incubating feature.
:app:clean :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE
:app:prepareAsiaIvityAndroidMarqueeview115Library
:app:prepareComAndraskindlerParallaxviewpagerParallaxviewpager031Library
:app:prepareComAndroidSupportAnimatedVectorDrawable2321Library
:app:prepareComAndroidSupportAppcompatV72321Library
:app:prepareComAndroidSupportMultidex101Library
:app:prepareComAndroidSupportRecyclerviewV72321Library
:app:prepareComAndroidSupportSupportV42321Library
:app:prepareComAndroidSupportSupportVectorDrawable2321Library
:app:prepareComGithubTecheryProgresshintLibrary023Library
:app:prepareComGithubTecheryProgresshintLibraryAddition023Library
:app:prepareComH6ah4iAndroidWidgetVerticalseekbarVerticalseekbar051Library
:app:prepareComOgaclejapanSmarttablayoutLibrary160Library
:app:prepareComToxicBakeryViewpagerTransformsViewPagerTransforms1232Library
: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 :app:generateDebugSources
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportMultidexInstrumentation101Library
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl :app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:mergeDebugAndroidTestShaders :app:compileDebugAndroidTestShaders
:app:generateDebugAndroidTestAssets :app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources :app:preDebugUnitTestBuild
UP-TO-DATE :app:prepareDebugUnitTestDependencies
:app:mockableAndroidJar UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac :app:compileDebugJavaWithJavac - is not
incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API. Note:
Recompile with -Xlint:deprecation for details.
:app:compileDebugNdk UP-TO-DATE :app:compileDebugSources
:app:buildInfoDebugLoader :app:transformClassesWithExtractJarsForDebug
:app:transformClassesWithInstantRunVerifierForDebug
:app:transformClassesWithJavaResourcesVerifierForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug
:app:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug
UP-TO-DATE :app:transformClassesWithInstantRunForDebug
:app:transformClasses_enhancedWithInstant+reloadDexForDebug
:app:incrementalDebugTasks :app:prePackageMarkerForDebug
:app:fastDeployDebugExtractor :app:generateDebugInstantRunAppInfo
:app:coldswapKickerDebug
:app:transformClassesWithInstantRunSlicerForDebug
:app:transformClassesWithDexForDebug To run dex in process, the Gradle
daemon needs a larger heap. It currently has approximately 11833 MB.
For faster builds, increase the maximum heap size for the Gradle
daemon to more than 13312 MB. To do this set
org.gradle.jvmargs=-Xmx13312M in the project gradle.properties. For
more information see
https://docs.gradle.org/current/userguide/build_environment.html
:app:validateDebugSigning :app:packageDebug :app:zipalignDebug
:app:fullDebugBuildInfoGenerator :app:assembleDebug
BUILD SUCCESSFUL
Total time: 7 mins 41.523 secs
The default Gradle Daemon VM memory allocation is 1 gigabyte — which is insufficient to support dexInProcess, so to take advantage you’ll need to set it to at least 2 gigabytes.
One thing you could do to speed up your builds is to increase the Gradle Daemon VM memory allocation.
In gradle.properties add the line org.gradle.jvmargs=-Xmx2048m.
Good read about Android Studio 2.1 feature Dex In Process:
https://medium.com/google-developers/faster-android-studio-builds-with-dex-in-process-5988ed8aa37e?_utm_source=1-2-2#.g4ba8piij
And also check out the video:
https://www.youtube.com/watch?v=-SY5nkNVUn0
Make your gradle offline.
Goto File -> Settings search for gradle and checked offline work .
My problem is solved.It was taking time because i have ubuntu and i was opening and running my project from external ntfs hard drive.I reformatted it as ext4 and followed the post given in comment section by Amit Vaghela , which reduced the build time from 7 min to 2 sec.
This is the link given by 'Amit Vaghela':
Building and running app via Gradle and Android Studio is slower than via Eclipse
Problem Solved:
Re-installed Java and got
java.lang.OutOfMemoryError: GC overhead limit exceeded
Added the following within the android block in gradle and it worked
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
Thank you everyone!
----------------------------------------------------------------------------
I'm getting a java error when I try to run an app that has both facebook and paypal sdk as dependencies. It works fine when I comment the facebook sdk dependency on gradle, but I need facebook login to work for my application too. Please help.
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'org.lucasr.twowayview:twowayview:0.1.4'
compile 'com.facebook.android:facebook-android-sdk:4.8.2'
compile files('libs/PayPalAndroidSDK-2.12.1.jar')
compile files('libs/httpcore-4.4.3.jar')
compile files('libs/httpclient-4.5.1.jar')
}
The error message:
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72220Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable830Library UP-TO-DATE
:app:prepareOrgLucasrTwowayviewTwowayview014Library 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
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:collectDebugMultiDexComponents UP-TO-DATE
:app:packageAllDebugClassesForMultiDex
:app:shrinkDebugMultiDexComponents
:app:createDebugMainDexClassList
:app:dexDebug
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:569)
at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
at com.android.dx.command.dexer.Main.run(Main.java:275)
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:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 39.781 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
If you have any libraries in your libs folder --> Right Click > Add as library
Then delete this line > compile fileTree(include: ['*.jar'], dir: 'libs')
OR
It must have been a problem with the Java install. Remove all traces of Java and reinstall. Answer here Android java.exe finished with non-zero exit value 1
Please make sure your Minimum SDK more or equal to API Level-15, check your project libs folder and make sure it should not have any 'Face Book' (.jar) files.
if you have two classes or variables with the same name except in first caracter (for me one starts with a capital letter) this will cause the problem if you're using java 1.8