88

Due to 65K error in my project I need it to migrate to Android Studio . While running

./gradlew assembleDebug

I am getting the 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 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1

I know this is very common error which all get while migrating an Eclipse project to Android Studio.

I have tried:

Execution failed for task ':app:transformClassesWithDexForDebug' - Gradle dependencies?

Execution failed for task ':app:transformClassesWithDexForDebug' while implementing Google sign in for Android

Android Studio TransformException : Error:Execution failed for task ':app:transformClassesWithDexForDebug'

Error:Execution failed for task ':app:transformClassesWithDexForDebug'

com.android.build.transform.api.TransformException

https://github.com/journeyapps/zxing-android-embedded/issues/110

I tried every solution, I tried to add .jar files one by one in my project, I used only those Google-services packages which are getting used in my project, I even added multidex jar.But nothing helps me

My Build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.petzview.android"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        abortOnError false
        checkReleaseBuilds false
    }

    dexOptions {
        incremental = true;
        maxProcessCount 4
        javaMaxHeapSize "4g"
        dexInProcess = false
        preDexLibraries = false
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.google.android.gms:play-services-ads:9.0.0'
    compile 'com.google.android.gms:play-services-plus:9.0.0'
    compile 'com.google.android.gms:play-services-gcm:9.0.0'
    compile project(':AVIOCtrlDefine')
    compile project(':Facebook')
    compile project(':SlidingMenu-master')
    compile 'com.android.support:multidex:1.0.1'
}
android.packagingOptions {
    exclude 'the META-INF / DEPENDENCIES'
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'the META-INF / LICENSE'
    exclude 'the META-INF / LICENSE.txt'
    exclude 'the META-INF / license.txt'
    exclude 'the META-INF / NOTICE'
    exclude 'the META-INF / the NOTICE.txt '
    exclude ' the META-INF / NOTICE.txt '
    exclude ' the META-INF / ASL2.0 '
    exclude ' the META-INF / Services / javax.annotation.processing.Processor '
}
apply plugin: 'com.google.gms.google-services'

My main gradle file:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
       classpath 'com.android.tools.build:gradle:2.1.0'
       classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Screenshot of my libs folder:

MyApplication.java:

public class MyApplication extends MultiDexApplication {
    private Object mTempObject = null;

    private boolean flagHomeFragmentFirstCreate = true;

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
        FacebookSdk.sdkInitialize(getApplicationContext());
    }

My Manifest class containing MyApplication:

 <application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:theme="@style/AppTheme">

After running

./gradlew assembleDebug --stacktrace

Error Log

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDexForDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
         org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: java.lang.RuntimeException:
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
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:54)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:57)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:173)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
         ... 60 more Caused by: 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
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:421)
at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:178)
at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:174)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
         ... 69 more Caused by: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.builder.core.AndroidBuilder.dexOutOfProcess(AndroidBuilder.java:1553)
at com.android.builder.core.AndroidBuilder.runDexer(AndroidBuilder.java:1495)
at com.android.builder.core.AndroidBuilder.convertByteCode(AndroidBuilder.java:1482)
 at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:251)
         ... 72 more Caused by: java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.builder.core.AndroidBuilder.dexOutOfProcess(AndroidBuilder.java:1549)
        ... 75 more Caused by: com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:43)
at com.android.builder.core.AndroidBuilder$3.call(AndroidBuilder.java:1538)
at com.android.builder.core.AndroidBuilder$3.call(AndroidBuilder.java:1531)
Caused by: org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:367)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:41)
         ... 2 more

Error while running application on device:

Error:trouble processing "java/awt/font/NumericShaper.class": Error:Ill-advised or mistaken usage of a core class (java.* or javax.*) Error:when not building a core library. Error:This is often due to inadvertently including a core library file Error:in your application's project, when using an IDE (such as Error:Eclipse). If you are sure you're not intentionally defining a Error:core class, then this is the most likely explanation of what's Error:going on. Error:However, you might actually be trying to define a class in a core Error:namespace, the source of which you may have taken, for example, Error:from a non-Android virtual machine project. This will most Error:assuredly not work. At a minimum, it jeopardizes the Error:compatibility of your app with future versions of the platform. Error:It is also often of questionable legality. Error:If you really intend to build a core library -- which is only Error:appropriate as part of creating a full virtual machine Error:distribution, as opposed to compiling an application -- then use Error:the "--core-library" option to suppress this error message. Error:If you go ahead and use "--core-library" but are in fact Error:building an application, then be forewarned that your application Error:will still fail to build or run, at some point. Please be Error:prepared for angry customers who find, for example, that your Error:application ceases to function once they upgrade their operating Error:system. You will be to blame for this problem. Error:If you are legitimately using some code that happens to be in a Error:core package, then the easiest safe alternative you have is to Error:repackage that code. That is, move the classes in question into Error:your own package namespace. This means that they will never be in Error:conflict with core system classes. JarJar is a tool that may help Error:you in this endeavor. If you find that you cannot do this, then Error:that is an indication that the path you are on will ultimately Error:lead to pain, suffering, grief, and lamentation. Error:1 error; aborting 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 '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 1 Information:BUILD FAILED

Where am I going wrong?

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
AndroidLearner
  • 881
  • 1
  • 6
  • 6

28 Answers28

30

Check build.gradle(Module: Android) fixed problem for me.

Modify it to workable version.

android {
    buildToolsVersion '23.0.1'
}
CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
Beatrice Lin
  • 1,456
  • 14
  • 17
24

Just a simple solution is here...it worked for me:

  1. Clean Project
  2. Rebuild project
  3. Sync project with gradle file
Ojonugwa Jude Ochalifu
  • 26,627
  • 26
  • 120
  • 132
PRIYA
  • 419
  • 4
  • 2
19

the steps I followed are:

  1. close Android Studio (or IntelliJ IDEA)
  2. in your project's directory:
    1. delete .idea directory
    2. delete .gradle directory
    3. delete all .iml files
      • find . | grep -e .iml$ | xargs rm
  3. use Android Studio to re-open the directory as a project

Terminal commands:

# close Android Studio
cd "your project's directory"
rm -rf ./.idea
rm -rf ./.gradle
find . | grep -e .iml$ | xargs rm
# use Android Studio to re-open the directory as a project
Eric
  • 16,397
  • 8
  • 68
  • 76
12

I had the same issue and I could solve it like this:

1) If your minSdkVersion is set to 21 or a higher value, the only thing you need to do is to set multiDexEnabled in your build.gradle file at the module level, as shown below:

android {
    defaultConfig {
        ...
        minSdkVersion 21 
        targetSdkVersion 28
        multiDexEnabled true
    }
    ...
}

2) However, if your minSdkVersion is set to 20 or less, you should use the MultiDex compatibility library, as follows:

2.1) Modify the module-level build.gradle file to enable MultiDex and add the MultiDex library as dependency, as shown below

android {
    defaultConfig {
        ...
        minSdkVersion 15 
        targetSdkVersion 28
        multiDexEnabled true
    }
    ...
}

dependencies {
  implementation 'com.android.support:multidex:1.0.3'
}

2.2) According to the Application class or not, do one of the following actions:

2.2.1) If you do not cancel the Application class, modify your manifest file to set android: name in the <application> tag as shown below:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapp">
    <application
            android:name="android.support.multidex.MultiDexApplication" >
        ...
    </application>
</manifest>

2.2.2) If you cancel the Application class, you must change it to extend MultiDexApplication (if possible) as shown below:

public class MyApplication extends MultiDexApplication { ... }

2.2.3) Also, if you override the Application class and can not change the base class, alternatively you can override the attachBaseContext () method and invoke MultiDex.install (this) to enable MultiDex:

public class MyApplication extends SomeOtherApplication {
  @Override
  protected void attachBaseContext(Context base) {
     super.attachBaseContext(base);
     MultiDex.install(this);
  }
}

Please use this link, it was really useful for me!

esterrrsinH
  • 171
  • 2
  • 11
  • in my case there was compile "com.google.android.gms:play-services:12.0.1" in gradle. I removed it and added its parts. Otherwise it s too heavy . – CodeToLife Jul 31 '19 at 14:38
4

Try to move:

apply plugin: 'com.google.gms.google-services'

just below:

apply plugin: 'com.android.application'

In your module Gradle file, then make sure all Google service's have the version 9.0.0.

Make sure that only this build tools is used:

classpath 'com.android.tools.build:gradle:2.1.0'

Make sure in gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

After all above is correct, then make menu File -> Invalidate caches and restart.

nbro
  • 15,395
  • 32
  • 113
  • 196
Stepan Maksymov
  • 2,618
  • 19
  • 31
  • Thanks stepan for your reply but on putting just below the com.android.application , produces errors as mentioned in link :- http://stackoverflow.com/questions/34370603/version-conflict-updating-to-8-4-0 – AndroidLearner Jun 02 '16 at 06:29
  • Hey,Stepan , i tried this but its not working giving me same error – AndroidLearner Jun 02 '16 at 07:41
  • applicationId "com.example.android" -> applicationId "com.petzview.android.commons" – Stepan Maksymov Jun 02 '16 at 07:53
  • i just changed it while adding question here , the real applicationId is "com.petzview.android" , let me change that in question too inorder to remove confusion – AndroidLearner Jun 02 '16 at 07:55
3

I have been struggling with this problem for 2 days. And tried all options. Finally noticed that after updating my android studio, it was not showing me the compile errors like @v.d. wrote above. My problem was, In my build files, I was using compile(which should be replaced with implementation or api) and testcompile(which also replaced by testimplementation). Notice that I have changed in whole build files(android, app and others - in my case I also had folding-cell library)

for example instead of this

compile project(path: ':folding-cell')

write this

implementation project(path: ':folding-cell')
Shomu
  • 2,734
  • 24
  • 32
rozeri dilar
  • 301
  • 1
  • 16
2

Its Just Simple the Compiler Did not accept the last changes you've made so go to the last file that you've made a change It will show the error just change it and recompile.

Kulasekar
  • 497
  • 5
  • 6
2

delete intermediates folder from app\build\intermediates. then rebuild the project. it will work

murali
  • 113
  • 1
  • 6
1

your manifest application name should contain application class name. Like

<application
        android:name="your package name.MyApplication"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:theme="@style/AppTheme"> 
dipankar
  • 11
  • 4
  • it's inside commons folder – AndroidLearner Jun 02 '16 at 08:06
  • i just put MyApplication.java class under main package and removed it from commons folder , but on running ./gradlew assembleDebug i am getting same error – AndroidLearner Jun 02 '16 at 09:16
  • just extend Application rather than MultiDexApplication, i think it will solve your problem. – dipankar Jun 02 '16 at 11:15
  • can you confirm your Application class getting called by using log or by debugging – dipankar Jun 02 '16 at 11:17
  • i remove multidexApplication and extend the Application but still same error – AndroidLearner Jun 02 '16 at 12:50
  • witch device you are using for testing? please put debugger point at MyApplication class and check whether debugger point is getting hit. – dipankar Jun 02 '16 at 13:13
  • sorry , i am not able to launch the application then how can i debug it – AndroidLearner Jun 02 '16 at 13:22
  • can you tell me which version of os your device contain means is it prelollipop device? – dipankar Jun 02 '16 at 13:36
  • its marshmallow 6.0 – AndroidLearner Jun 02 '16 at 13:39
  • in my case using android studio 2.0 preview 4 I suddenly got that problem and adding multiDexEnabled true didn't help, and also clean and rebuilt didn't help. so the only thing that solved it for me is deleting that file: YOUR_APP_NAME\app\build\intermediates and run the application and it works. have you tried this? – dipankar Jun 02 '16 at 13:49
  • yes , i already tried it , but in my case its also not working , while running i am getting one error Error:trouble processing "java/awt/font/NumericShaper.class": Error:Ill-advised or mistaken usage of a core class (java.* or javax.*), Have you ever faced it ? – AndroidLearner Jun 02 '16 at 13:54
  • please give your whole build.gradle screenshots.Above screenshots half of your build.gradle file is visible – dipankar Jun 02 '16 at 14:18
  • its already on top below the links i have provided , please check – AndroidLearner Jun 02 '16 at 14:24
  • dude can you please give a try with latest buildToolsVersion "X.Y.Z". latest tool version is 23.0.3 (buildToolsVersion "23.0.3".).if you don't have it please download it. – dipankar Jun 02 '16 at 14:31
1

for me it was just a little compile error and sadly Android Studio doesn't show it . please search manually . trying to enable work offline and clean&rebuild may help you more

Vahid
  • 1,588
  • 4
  • 22
  • 34
1

Just remove this line from build.gradle(Project folder)

apply plugin: 'com.google.gms.google-services'

Now rebuild the application. works fine Happy coding

1

Apply in ProGuard-rules

-ignorewarnings
Shomu
  • 2,734
  • 24
  • 32
1

My Simple Answer is and only solution...

Please Check The layout files, which you added lastly there MUST be a error in the .xml file for sure.

We may simply copy and pasting .xml file from other project and something missing in the xml file..

Error in the .xml file would be some of the below....

  1. Something missing in Drawable folder or String.xml Or Dimen.xml...

After Placing all the available code in the respected folders do not forget to CLEAN The Project...

1

I have disabled Instant Run feature from the preferences and the issue was solved.

Subhash_Reddy
  • 438
  • 6
  • 13
1

Invalidate Caches works for me

Dimitrov
  • 11
  • 1
1
        If you are updating your build.gradle(app) with latest version and third party library include in project that's why you need to update your library with latest version in same file. 

In my case i've to update my dependency with below version code.
    
    dependencies {
            classpath 'com.android.tools.build:gradle:3.3.2'
            classpath 'com.google.gms:google-services:4.3.4'
            classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0'
            } 

It should look like this:
        
            dependencies {
                classpath 'com.android.tools.build:gradle:8.1.0'
                classpath 'com.google.gms:google-services:4.3.4'
                classpath 'org.greenrobot:greendao-gradle-plugin:3.3.1'
            } 
MEGHA DOBARIYA
  • 1,622
  • 9
  • 7
0

For me the only thing that works is to add to repositories

maven {
        url "https://maven.google.com"
    }

It should look like this:

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
0

For my case, I follow the steps from Firebase and by mistake I pated it in a wrong file.

Then, I returned to the project from Project to Android. Once in the Android view I pasted the file /projectname/app/YOUR-FILE-HERE and now, you have to compile again.

Benjamin RD
  • 11,516
  • 14
  • 87
  • 157
0

you just change import android.support.v7.app.ActionBarActivity; to import android.support.v7.app.AppCompatActivity;

and extends AppCompatActivity

0

Well in my case i was accessing an static array of a class by reference of that class, but as we know we can directly access static member via class name. So when I replaced reference with class name where I was accessing that array. It fixed this error.

Suraj Vaishnav
  • 7,777
  • 4
  • 43
  • 46
0

Add multiDexEnabled true to your app-level Gradle, like this:

defaultConfig {
    multiDexEnabled true
    ...
}
Anthony Cannon
  • 1,245
  • 9
  • 20
Houssin Boulla
  • 2,687
  • 1
  • 16
  • 22
0

Migrate to androidX library

With Android Studio 3.2 and higher, you can migrate an existing project to AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.

Source: https://developer.android.com/jetpack/androidx/migrate

PSN
  • 2,326
  • 3
  • 27
  • 52
0

clear project and then run. it will work

murali
  • 113
  • 1
  • 6
0

If anyone is facing a similar type of error while adding ShimmerRecyclerView Loader, make sure to add: maven { url "https://jitpack.io" } under allprojects in your app-level Gradle, like below:

allprojects {
    repositories {
        google()
        jcenter()
        // Add it here
        maven { url "https://jitpack.io" }
    }
}
Anthony Cannon
  • 1,245
  • 9
  • 20
Badri Paudel
  • 1,365
  • 18
  • 19
0

In my case, I am also facing this types of error while run the project in Android Studio. It may be facing this types of error due to dependencies need to be upgrade with higher evrsion.

I have used below dependencies

implementation 'jp.wasabeef:glide-transformations:3.3.0'

Now changed with upgraded version as below

implementation 'jp.wasabeef:glide-transformations:4.3.0'

Now sync the build.gradle then run the app is successfully.

Pratik Dodiya
  • 2,337
  • 1
  • 19
  • 12
0

for me, it was the missing Manifest file that was to blame. I created a new module and forgot to add Manifest

Dan Alboteanu
  • 9,404
  • 1
  • 52
  • 40
0

Just update your libraries in build.gradle(Project folder) and try again

Prashanth
  • 993
  • 8
  • 18
-1

first you remove this thing in your project .. its is in build.gradle(module:app) then build your app now you project show the actual error and you find what is your actual problem is .. and after you find actual problem again paste it where its is belong to

allprojects { gradle.projectsEvaluated {

    tasks.withType(JavaCompile)

{ options.encoding = 'UTF-8'

        options.compilerArgs

<< "-Xlint:unchecked" << "-Xlint:deprecation"}]}}

benten
  • 696
  • 7
  • 18