Skip to content Skip to sidebar Skip to footer

Why Project Doesn't Compile On Android Studio 1.5.1?

Previously, there were no problems. I put a fresh Android Studio 1.5.1 for OS X 10.11 and gives this error: Information:Gradle tasks [:app:assembleDebug] :android_tools:preBuild UP

Solution 1:

remove compile 'com.google.android.gms:play-services:8.4.0' from build gradle file and try again

Because you have to use full Google play service lib or separate parts of Google play service. use one of them.

below is used full Google play service libs

compile'com.google.android.gms:play-services:8.4.0'

so if you are using separate portion of Google play service( like com.google.android.gms:play-services-ads:8.4.0) then no need to add that.

that's why your app dex size increase Over 65K Methods


From documentation

Selectively compiling APIs into your executable

In versions of Google Play services prior to 6.5, you had to compile the entire package of APIs into your app. In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit.

From version 6.5, you can instead selectively compile Google Play service APIs into your app. For example, to include only the Google Fit and Android Wear APIs, replace the following line in your build.gradle file:

compile 'com.google.android.gms:play-services:8.4.0' with these lines:

compile 'com.google.android.gms:play-services-fitness:8.4.0' compile 'com.google.android.gms:play-services-wearable:8.4.0'

Solution 2:

Perhaps you're seeing this issue?

I'll copy the solution from that post here, just in case the link breaks in the future.

If you compile with "--info --debug" and notice an out-of-memory error, adding this block to gradle.build should resolve it.

android {
    dexOptions {
        incremental = true;
        preDexLibraries = false
        javaMaxHeapSize "4g"// 2g should be also OK
    }
}

Solution 3:

Problem was solved by installing jdk8 instead of jdk7

Post a Comment for "Why Project Doesn't Compile On Android Studio 1.5.1?"