Android studio: Gradle build finished with error - android

I have been using Android Studio and I am getting this error when trying to build.I can't able to proceed.
This is the error in Android Studio:
Executing tasks: [:libraries:facebook:generateDebugSources, :library:generateDebugSources, :volley:generateDebugSources]
Configuration on demand is an incubating feature.
WARNING [Project: :volley] "testPackageName" is deprecated (and will soon stop working); change to "testApplicationId" instead
:libraries:facebook:preBuild
:libraries:facebook:preDebugBuild
:libraries:facebook:checkDebugManifest
:libraries:facebook:prepareDebugDependencies
:libraries:facebook:compileDebugAidl UP-TO-DATE
:libraries:facebook:compileDebugRenderscript UP-TO-DATE
:libraries:facebook:generateDebugBuildConfig UP-TO-DATE
:libraries:facebook:generateDebugAssets UP-TO-DATE
:libraries:facebook:mergeDebugAssets UP-TO-DATE
:libraries:facebook:generateDebugResValues UP-TO-DATE
:libraries:facebook:generateDebugResources UP-TO-DATE
:libraries:facebook:packageDebugResources UP-TO-DATE
:libraries:facebook:processDebugManifest UP-TO-DATE
:libraries:facebook:processDebugResources UP-TO-DATE
:libraries:facebook:generateDebugSources UP-TO-DATE
:library:preBuild
:library:preDebugBuild
:library:checkDebugManifest
:library:prepareDebugDependencies
:library:compileDebugAidl UP-TO-DATE
:library:compileDebugRenderscript UP-TO-DATE
:library:generateDebugBuildConfig UP-TO-DATE
:library:generateDebugAssets UP-TO-DATE
:library:mergeDebugAssets UP-TO-DATE
:library:generateDebugResValues UP-TO-DATE
:library:generateDebugResources UP-TO-DATE
:library:packageDebugResources UP-TO-DATE
:library:processDebugManifest UP-TO-DATE
:library:processDebugResources UP-TO-DATE
:library:generateDebugSources UP-TO-DATE
:volley:preBuild
:volley:preDebugBuild
:volley:checkDebugManifest
:volley:prepareDebugDependencies
:volley:compileDebugAidl UP-TO-DATE
:volley:compileDebugRenderscript UP-TO-DATE
:volley:generateDebugBuildConfig UP-TO-DATE
:volley:generateDebugAssets UP-TO-DATE
:volley:mergeDebugAssets UP-TO-DATE
:volley:generateDebugResValues UP-TO-DATE
:volley:generateDebugResources UP-TO-DATE
:volley:packageDebugResources UP-TO-DATE
:volley:processDebugManifest UP-TO-DATE
:volley:processDebugResources UP-TO-DATE
:volley:generateDebugSources UP-TO-DATE
BUILD FAILED
Total time: 2 mins 7.494 secs
This is my app gradle :
build.gradle :
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
signingConfigs {
release {
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/ASL2.0'
}
productFlavors {
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.android.gms:play-services:5.0.77'
compile 'com.android.support:appcompat-v7:+'
compile 'com.makeramen:roundedimageview:1.2.4'
compile 'com.nineoldandroids:library:2.4.0+'
compile project(':libraries:facebook')
compile project(':library')
compile project(':stripe')
compile project(':volley')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/activation.jar')
compile files('libs/mail.jar')
compile files('libs/iprint.jar')
}

This Question is old but it may be useful for new programmers of Android Studio ,
So this error in my case solved by cleaning project from Build Menu.

I'm not sure if you post all error's text, in my case in the end will be very useful information to fix this trouble. Maybe in your case trouble is the same.
So, in my case was trouble with dependecies.
In my app module in build.grale I used other dependencies for support.v4
In your case: compile 'com.android.support:support-v4:19.1.0'
Facebook SDK used jar, so, support.v4 was added as jar.
To fix this, just remove jar, and add to your Facebook build.gradle file the same line to import support library as on your main app module.
Hope, this will help you.

I faced same issue today
This is a bug in dex merger when the dex files that are being merged have more than 65536 methods (or strings). We can fix this by adding
dexOptions {
jumboMode = true
}
In the gradle file. Don’t forget to add this all sub projects too else it may not work.

I faced this problem in ubuntu 16.04 and came up with a simple solution:
Type sudo nautilus in terminal.
Now go to the root directory and recursively change permissions to Read and Write and Create and Delete files. You will be able to do that by the option Change permissions for enclosed files.

Related

Android studio minify enabled = true , not able to generate apk?

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'realm-android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultPublishConfig "debug"
defaultConfig {
applicationId "com.youth4work.ibps"
minSdkVersion 16
targetSdkVersion 23
multiDexEnabled true
versionCode 1
versionName "1.0.0"
}
signingConfigs {
release {
storeFile file('keystore/youth4work_second_key')
keyAlias 'youth4work_second_key_alias'
keyPassword "youth4work"
storePassword "youth4work"
}
debug {
storeFile file('keystore/debug.keystore')
keyAlias 'androiddebugkey'
storePassword 'android'
keyPassword 'android'
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
versionNameSuffix "Debug"
debuggable true
}
}
lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
retrolambda {
jvmArgs '-noverify'
}
dependencies {
final PLAY_SERVICES_VERSION = '8.3.0'
final SUPPORT_LIBRARY_VERSION = '23.3.0'
// Google Play Services
compile "com.google.android.gms:play-services-base:$PLAY_SERVICES_VERSION"
compile "com.google.android.gms:play-services- analytics:$PLAY_SERVICES_VERSION"
compile "com.google.android.gms:play-services-gcm:$PLAY_SERVICES_VERSION"
compile "com.google.android.gms:play-services-plus:$PLAY_SERVICES_VERSION"
// Support Libraries
compile "com.android.support:support-v4:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:recyclerview-v7:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:cardview-v7:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:design:$SUPPORT_LIBRARY_VERSION"
compile 'com.android.support:support-annotations:23.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.jakewharton.timber:timber:4.1.0'
compile 'com.jakewharton.rxbinding:rxbinding:0.4.0'
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
compile 'com.github.kevinsawicki:timeago:1.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.8.2'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.mobsandgeeks:android-saripaar:2.0.2'
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.1'
compile 'com.github.jakob-grabner:Circle-Progress-View:1.2.8'
compile 'com.github.vlonjatg:progress-activity:v1.0.3'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.4'
compile 'com.daasuu:animateHorizontalProgressBar:0.2.2'
compile 'io.reactivex:rxjava:1.1.0'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'com.trello:rxlifecycle:0.4.0'
compile 'com.trello:rxlifecycle-components:0.4.0'
compile('com.github.afollestad.material-dialogs:core:0.8.5.6#aar') {
transitive = true
}
compile('com.mikepenz:fastadapter:1.4.0#aar') {
transitive = true
}
testCompile 'junit:junit:4.12'
}
// Log out test results to console
tasks.matching { it instanceof Test }.all {
testLogging.events = ["failed", "passed", "skipped"]
}
here if i make minify enabled = false the code runs fine while if i use true the code shows
Information:Gradle tasks [:app:assembleRelease] google-services plugin
could not detect any version for com.google.android.gms, default
version: 8.3.0 will be used. please apply google-services plugin at
the bottom of the build file. :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:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72330Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42330Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2330Library
UP-TO-DATE :app:prepareComDaasuuAnimateHorizontalProgressBar022Library
UP-TO-DATE :app:prepareComFacebookAndroidFacebookAndroidSdk482Library
UP-TO-DATE
:app:prepareComGithubAfollestadMaterialDialogsCore0856Library
UP-TO-DATE
:app:prepareComGithubJakobGrabnerCircleProgressView128Library
UP-TO-DATE :app:prepareComGithubSiyamedAndroidShapeImageview093Library
UP-TO-DATE :app:prepareComGithubVlonjatgProgressActivityV103Library
UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics830Library
UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBase830Library
UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement830Library
UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesGcm830Library
UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library
UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesPlus830Library
UP-TO-DATE :app:prepareComJakewhartonRxbindingRxbinding040Library
UP-TO-DATE :app:prepareComJakewhartonTimberTimber410Library UP-TO-DATE
:app:prepareComJoanzapataIconifyAndroidIconify211Library UP-TO-DATE
:app:prepareComJoanzapataIconifyAndroidIconifyFontawesome211Library
UP-TO-DATE :app:prepareComMikepenzFastadapter140Library UP-TO-DATE
:app:prepareComRengwuxianMaterialedittextLibrary214Library UP-TO-DATE
:app:prepareComTrelloRxlifecycle040Library UP-TO-DATE
:app:prepareComTrelloRxlifecycleComponents040Library UP-TO-DATE
:app:prepareIoReactivexRxandroid110Library UP-TO-DATE
:app:prepareIoRealmRealmAndroidLibrary0883Library UP-TO-DATE
:app:prepareMeZhanghaiAndroidMaterialprogressbarLibrary114Library
UP-TO-DATE :app:prepareReleaseDependencies :app:compileReleaseAidl
:app:compileReleaseRenderscript :app:generateReleaseBuildConfig
:app:generateReleaseAssets UP-TO-DATE :app:mergeReleaseAssets
:app:generateReleaseResValues UP-TO-DATE
:app:processReleaseGoogleServices :app:generateReleaseResources
:app:mergeReleaseResources :app:processReleaseManifest
:app:processReleaseResources :app:generateReleaseSources
:app:compileReleaseJavaWithJavac 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:compileRetrolambdaRelease :app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources :app:prePackageMarkerForRelease
:app:transformClassesWithRealmTransformerForRelease
:app:processReleaseJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForRelease
:app:transformClassesAndResourcesWithProguardForRelease assmember)
Warning:there were 1 unresolved references to library class members.
You probably need to update the library versions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Warning:Exception while processing task java.io.IOException: Please
correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED
Error:Execution failed for task
':app:transformClassesAndResourcesWithProguardForRelease'.
java.io.IOException: Please correct the above warnings first. Information:BUILD FAILED Information:Total time: 27.946 secs
Information:1 error Information:91 warnings Information:See complete
output in console
If you enable minifying, the build will call Proguard to strip out every unnecessary classes, members and methods.
For this to work, you'll need a proguard config file, which will tell Proguard which classes are your entrypoint to your classes and which members and methods should be kept.
The error you are seeing is a common error for mismatching method calls.
The error includes a link to the Proguard manual, describing the error a bit more: you'll have to make sure that you are using the right Android Build Target and that you keep all necessary libs and their methods.
Try to adapt the Android Build Target in your properties. If this doesn't work, you'll have to check if you need more entries in your proguard config.

Android Studio: Execution failed for task ':app:transformClassesWithDex'

I'm adding in a few libraries from Apache POI I had overcome several problems, but am now stuck on this error message when i'm trying to run the app;
> Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72221Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2221Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72221Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42221Library UP-TO-DATE
:app:prepareComBignerdranchAndroidExpandablerecyclerview103Library UP-TO-DATE
:app:prepareComGithubTraexExpandablelayoutLibrary13Library 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:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithDexForDebug
trouble processing "javax/xml/stream/events/StartElement.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.
This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.
However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. This will most
assuredly not work. At a minimum, it jeopardizes the
compatibility of your app with future versions of the platform.
It is also often of questionable legality.
If you really intend to build a core library -- which is only
appropriate as part of creating a full virtual machine
distribution, as opposed to compiling an application -- then use
the "--core-library" option to suppress this error message.
If you go ahead and use "--core-library" but are in fact
building an application, then be forewarned that your application
will still fail to build or run, at some point. Please be
prepared for angry customers who find, for example, that your
application ceases to function once they upgrade their operating
system. You will be to blame for this problem.
If you are legitimately using some code that happens to be in a
core package, then the easiest safe alternative you have is to
repackage that code. That is, move the classes in question into
your own package namespace. This means that they will never be in
conflict with core system classes. JarJar is a tool that may help
you in this endeavor. If you find that you cannot do this, then
that is an indication that the path you are on will ultimately
lead to pain, suffering, grief, and lamentation.
1 error; aborting
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_77\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 23.816 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
Things I've tried:
Using Enabling Multidex with javaMaxHeapSize
Different versions of my required libraries
Clean/Build 9000+ times
Using the .java files (from apache site) and adding them to the dependencies
Disabling proguard (for some reason)
Going back and configuring JAVA_HOME + path
Updating java (which ill try revert back to 1.7 tomorrow)
and probably some other stuff.
Here is my build.gradle file without the error
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
}
defaultConfig {
applicationId "com.example.justin.wordcreator"
minSdkVersion 21
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['Parse-*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.bignerdranch.android:expandablerecyclerview:1.0.3'
compile 'com.github.traex.expandablelayout:library:1.3'
compile 'org.apache.poi:poi-scratchpad:3.14'
compile 'com.github.virtuald:curvesapi:1.03'
compile 'org.apache.poi:poi:3.14'
compile 'xmlbeans:xmlbeans:2.3.0'
}
If narrowed it down to these three libraries (Im using xmlbeans 2.3, but would like to get 2.6 working)
compile 'org.apache.xmlbeans:xmlbeans:2.6.0'
compile 'org.apache.poi:poi-ooxml:3.14'
compile 'org.apache.poi:poi-ooxml-schemas:3.14'
once i add any or all of them I get that error message.
There are some things that break when using bare POI on Android, e.g. the XMLBeans jar file has forbidden and duplicated classes which causes Android compilation to fail.
Take a look at https://github.com/andruhon/android5xlsx which provides adjusted jar-files that seem to make using Apache POI on Android 5.x possible.

Error:Execution failed for task ':app:processDebugResources'. > at index 4

I having problem while building my project after revision 2 update of the latest SDK(Sorry,I dont remeber the version number).I run the code succesfully before. I dont think there is any error in my project.I often get error message as "IDE internal error occured" is that anything to do with this. please help thanks.Required codes are given below
app/build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "io.sleeko.board"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2') {
exclude module: 'support-v4'
}
compile 'com.android.support:recyclerview-v7:23.0.1'
compile('com.github.nkzawa:socket.io-client:0.6.0') {
exclude group: 'org.json', module: 'json'
}
// compile project(':Emojicon')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.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:recyclerview-v7:23.1.0'
compile 'me.relex:circleindicator:1.1.5#aar'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.github.rahatarmanahmed:circularprogressview:2.3.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.traex.rippleeffect:library:1.3'
compile 'com.alexbbb:uploadservice:1.4'
compile 'com.github.satyan:sugar:1.3'
compile 'com.mikhaellopez:circularimageview:2.0.2'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
}
Message Gradle Build:
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAlexbbbUploadservice14Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72310Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72310Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2310Library UP-TO-DATE
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72310Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42310Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk470Library UP-TO-DATE
:app:prepareComGithubRahatarmanahmedCircularprogressview232Library UP-TO-DATE
:app:prepareComGithubSatyanSugar13Library UP-TO-DATE
:app:prepareComGithubTraexRippleeffectLibrary13Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus810Library UP-TO-DATE
:app:prepareComMikhaellopezCircularimageview202Library UP-TO-DATE
:app:prepareMeRelexCircleindicator115Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources FAILED
Error:Execution failed for task ':app:processDebugResources'.
> at index 4
Information:BUILD FAILED
Information:Total time: 24.365 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
Event log
3:26:52 PM NullPointerException: Failed to set up Android modules in project
On clicking NullPointerException it says to report to google with details as below:
Failed to set up Android modules in project 'bridgewith'
java.lang.NullPointerException
at com.intellij.openapi.util.io.FileUtilRt.toSystemIndependentName(FileUtilRt.java:207)
at com.intellij.openapi.util.io.FileUtil.toSystemIndependentName(FileUtil.java:634)
at org.jetbrains.android.sdk.AndroidSdkUtils.getPlatformDir(AndroidSdkUtils.java:218)
at org.jetbrains.android.sdk.AndroidSdkUtils.getPlatformAndAddOnJars(AndroidSdkUtils.java:122)
at org.jetbrains.android.sdk.AndroidSdkUtils.getLibraryRootsForTarget(AndroidSdkUtils.java:156)
at org.jetbrains.android.sdk.AndroidSdkUtils.setUpSdk(AndroidSdkUtils.java:409)
at org.jetbrains.android.sdk.AndroidSdkUtils.createNewAndroidPlatform(AndroidSdkUtils.java:359)
at org.jetbrains.android.sdk.AndroidSdkUtils.createNewAndroidPlatform(AndroidSdkUtils.java:336)
at org.jetbrains.android.sdk.AndroidSdkUtils.createNewAndroidPlatform(AndroidSdkUtils.java:327)
at org.jetbrains.android.sdk.AndroidSdkUtils.tryToCreateAndroidSdk(AndroidSdkUtils.java:617)
at com.android.tools.idea.gradle.customizer.android.AndroidSdkModuleCustomizer.customizeModule(AndroidSdkModuleCustomizer.java:92)
at com.android.tools.idea.gradle.customizer.android.AndroidSdkModuleCustomizer.customizeModule(AndroidSdkModuleCustomizer.java:48)
at com.android.tools.idea.gradle.service.AndroidGradleModelDataService.customizeModule(AndroidGradleModelDataService.java:330)
at com.android.tools.idea.gradle.service.AndroidGradleModelDataService.access$100(AndroidGradleModelDataService.java:88)
at com.android.tools.idea.gradle.service.AndroidGradleModelDataService$1.run(AndroidGradleModelDataService.java:159)
at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:166)
at com.intellij.openapi.application.RunResult.run(RunResult.java:38)
at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:114)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:111)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:108)
at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:80)
at com.android.tools.idea.gradle.service.AndroidGradleModelDataService.doImport(AndroidGradleModelDataService.java:136)
at com.android.tools.idea.gradle.service.AndroidGradleModelDataService.importData(AndroidGradleModelDataService.java:122)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:132)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:102)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:141)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager.importData(ProjectDataManager.java:148)
at com.android.tools.idea.gradle.util.Projects$1$1$1.run(Projects.java:130)
at com.intellij.openapi.roots.impl.ProjectRootManagerImpl.mergeRootsChangesDuring(ProjectRootManagerImpl.java:328)
at com.android.tools.idea.gradle.util.Projects$1$1.run(Projects.java:126)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
at com.android.tools.idea.gradle.util.Projects$1.run(Projects.java:122)
at com.intellij.util.ui.UIUtil.invokeAndWaitIfNeeded(UIUtil.java:2369)
at com.android.tools.idea.gradle.util.Projects.populate(Projects.java:115)
at com.android.tools.idea.gradle.project.ProjectSetUpTask$2.run(ProjectSetUpTask.java:113)
at com.intellij.ide.startup.impl.StartupManagerImpl$7.run(StartupManagerImpl.java:369)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:734)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:569)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Try the latest version of Android SDK build tools.
buildToolsVersion "23.0.3"
Good luck.
I had the same problem. Then I tried the solution from issue #195094 and it worked.
My problem likely was caused by the error I got while updating the sdk tools at the same time than Android Studio, trying to get both of them updated without closing AS beforehand. As a result, the SDK manager was marking the package as partially installed. After completely installing it, setting buildtoolsversion to 23.0.2, and then "invalidating caches and restart" the problem disappeared!
I had the same problem and I noticed that Android 6.0 was partially installed. After completing download everything worked. It was hard to figure this because Android 6.0 was working before and then decided to try out the new emulator and downloaded system images and I guess loading those was not completed.
As you may have already found, this error can be visible due to many reasons. Hence you need to find actual reason behind the error.
Navigate to android folder and issue below command;
gradlew --info clean build
This will list the actual issue, rectify that and redo the build.
Hope this is helpful!
Use this :
buildToolsVersion "21.0.1"
You will find this setting inside the file app/build.gradle.
Based off the following log files:
"Failed to set up Android modules in project 'bridgewith'
java.lang.NullPointerException
at com.intellij.openapi.util.io.FileUtilRt.toSystemIndependentName(FileUtilRt.java:207)
at com.intellij.openapi.util.io.FileUtil.toSystemIndependentName(FileUtil.java:634)
at org.jetbrains.android.sdk.AndroidSdkUtils.getPlatformDir(AndroidSdkUtils.java:218)
at org.jetbrains.android.sdk.AndroidSdkUtils.getPlatformAndAddOnJars(AndroidSdkUtils.java:122)
at org.jetbrains.android.sdk.AndroidSdkUtils.getLibraryRootsForTarget(AndroidSdkUtils.java:156)
at org.jetbrains.android.sdk.AndroidSdkUtils.setUpSdk(AndroidSdkUtils.java:409)
at org.jetbrains.android.sdk.AndroidSdkUtils.createNewAndroidPlatform(AndroidSdkUtils.java:359)"
I think it's a problem with your Android Studio/Intellij IDE. Please uninstall Android Studio in your Programs and Features. Here:
Then reinstall Andriod Studio again. Go to Google's Android Studio download site and download and install the IDE.
I had a similar error and the problem came from a corrupt adb.exe file inside my user/android-sdks/platform-tools folder. So I had to delete my platform tools folder and then reinstall platform-tools using SDK Manager.

Error:Execution failed for task ':app:dexDebug' inished with non-zero exit value 2 in android studio

I have faced a unknown type of error.
here my build.grable:-
apply plugin: 'com.android.application'
repositories {
maven { url "https://jitpack.io" }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "shoppingmazza.android.catalyst.com.shoppingmazza"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile files('libs/fluent-hc-4.5.jar')
compile files('libs/httpclient-4.5.jar')
compile files('libs/httpclient-cache-4.5.jar')
compile files('libs/httpclient-win-4.5.jar')
compile files('libs/httpcore-4.4.1.jar')
compile files('libs/httpmime-4.5.jar')
compile files('libs/jna-4.1.0.jar')
compile files('libs/jna-platform-4.1.0.jar')
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile files('libs/commons-net-3.0.1.jar')
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1#aar'
}
and here my logcat:-
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72310Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2310Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72310Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42310Library UP-TO-DATE
:app:prepareComDaimajiaSliderLibrary115Library UP-TO-DATE
:app:prepareComGithubJakeWhartonViewPagerIndicator241Library 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:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
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)
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.8.0_51\bin\java.exe'' finished with non-zero exit value 2
I am new in android developing.Anyone can help me solved my problem. I near my to complete project. Please help me. Thanks in advance!
Add this inside your android block:
dexOptions {
preDexLibraries = false
}
Your project methods is over 65k. You should implement Multidex
if your project has more than 65K method , you have to enable multiDex option in gradle ,, to make sure if the problem caused by multiDex ,, just run your app on a lolipop device if it running fine , then the problem is MultiDex ,
lolipop doesn't use Dalvik thats why it will running fine
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
You are adding twice the support-library v4.
It happens because you are using
compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1#aar'
You are getting this library from the jitpack.
This library adds the support library as a jar and not as a gradle dependency.
It means that the pom file doesn't have a dependency and you can't exclude the jar file with gradle because the jar is inside the aar file (without a pom how can gradle know that these files should be excluded?).
You can check the files in the jitpack repo:
pom file
aar file
You can try to use the same library from other repo, for example:
`fr.avianey.com.viewpagerindicator:library:2.4.1`
You can check this issue on github.

Gradle build failed - Apache HttpEntity

I get this error when I try to run my application:
Information:Gradle tasks [:app:assembleDebug]
Warning:Dependency org.apache.httpcomponents:httpclient:4.3.5 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.3.5 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72200Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72200Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42200Library 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:compileDebugJava UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug
Error:duplicate files during packaging of APK /Users/.../app/build/outputs/apk/app-debug-unaligned.apk
Path in archive: META-INF/NOTICE
Origin 1: /Users/.../.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpclient-android/4.3.5/82edcaec6c7b4599eaeaaf11167ceea41db42f33/httpclient-android-4.3.5.jar
Origin 2: /Users/.../.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpmime/4.3.5/1dd0d38df9c6d21e893f2e52403f1cd99e91cd81/httpmime-4.3.5.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/NOTICE'
}
}
Error:Execution failed for task ':app:packageDebug'.
> Duplicate files copied in APK META-INF/NOTICE
File 1: /Users/.../.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpclient-android/4.3.5/82edcaec6c7b4599eaeaaf11167ceea41db42f33/httpclient-android-4.3.5.jar
File 2: /Users/.../.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpclient-android/4.3.5/82edcaec6c7b4599eaeaaf11167ceea41db42f33/httpclient-android-4.3.5.jar
Information:BUILD FAILED
Information:Total time: 2.754 secs
Information:2 errors
Information:2 warnings
Information:See complete output in console
Here is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "..."
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
compile (group: 'org.apache.httpcomponents' , name: 'httpmime' , version: '4.3.5') {
exclude module: 'org.apache.httpcomponents:httpclient'
}
}
I simply want to import the following libraries:
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.ContentBody;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
so I can run the following code:
String sendProfileData = getResources().getString(R.string.URL);
DefaultHttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(sendProfileData);
MultipartEntity mpEntity = new MultipartEntity();
try {
mpEntity.addPart("first_name", new StringBody("Jay"));
mpEntity.addPart("last_name", new StringBody("Shmidt"));
...
}
...
What exactly is wrong here - Do I actually need to delete or replace jar files? Why isn't gradle taking care of this?
Any advice would be really helpful. Thanks in advance!
Update: I got the answer from this post
Android Gradle plugin 0.7.0: "duplicate files during packaging of APK"
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
}
Thats not problem in Android Studio only your system require internet connection
Just extends class MultipartEntity
Than press Alt+Enter
Than click find jar on web
Select httpmime-4.0-alpha4.jar
Than right click on project structure
Click open module setting
In dependencies tab click on + icon on right side
Than click on file dependency select http:mime file added
Finally build project

Categories

Resources