15
votes

I use com.android.tools.build:gradle:2.0.0-alpha3 and gradle 2.8 before I update to Android Studio 2.0 preview 5. It works fine.

After I update to 2.0 preview 5,it tells me to update to com.android.tools.build:gradle:2.0.0-alpha5 and gradle 2.10.

I can't build and run my app normally now. It always uses a old copy of my code though I have changed the code and costs more time to build.

If I turn back to com.android.tools.build:gradle:2.0.0-alpha3 and gradle 2.8.It become right.

Android Studio Version (http://tools.android.com/recent)

Android Gradle Plugin Version (http://tools.android.com/tech-docs/new-build-system)

Android Studio Preview 6 was posted on Jan 21, 2016. Android Studio Preview 7 was posted on Jan 23, 2016.

You can see that the Android Studio Preview updates frequently. If you don't want to deal all kinds of bugs, you would better to use a stable version.

If you want to use more features, you should always keep latest version to avoid bugs.

6
For production use you should not use alpha versions of the tools. Go back to a stable environment for day to day use. Alpha versions are there for people to try out and give early feedback. - Henry
@Henry I want to build faster.Old version takes too much time to build. - tiny sunlight
Think again, is it really faster if you run into problems? - Henry
I turned back to old version.But I want to use the latest version if possible. - tiny sunlight
What error do you receive? I can't build and run my app normally now is not enough to get help. - Sufian

6 Answers

3
votes

There's a quick fix listed on google plus by the android dev team in the comments (post).

Set dexInProcess equal to false in your build.gradle:

dexOptions {  
    javaMaxHeapSize "4g"  
    dexInProcess false  //the magic line
}
2
votes

You can try this: go to project stucture from file-->menu or command-; in mac. Then (don't try changing the android plugin version to 2.10) change the android plugin version to same as your current android gradle build as illustrated in the image below:

enter image description here

2
votes

Your problem is with instant run, because if project builds and APK installs, it can't be Gradle issue.

Instant Run is still under development and has this issue of not working properly.

To disable the instant run:

  1. open properties,
  2. go to Editor > Build, Execution, Development > Instant Run,
  3. uncheck Enable instant Run to hotswap code
1
votes

Update your plugin to

classpath 'com.android.tools.build:gradle:2.0.0-alpha6'

You may get “Gradle Version 2.10 is required.” Error. Try this

1
votes

Sometimes you must change the gradle versión settings and the wrapper file if you are using a local distribution.

  1. File > Settings > Build, Execution, Deployment > Build Tools > Gradle
  2. Gradle Home to gradle-2.10
  3. Apply
  4. C:\Users\ ...\project\gradle\wrapper\gradle-wrapper.properties to gradle-2.10-all.zip

if step 4 is missing, Android studio goes back to gradle-2.8, so i would have to do steps 1-3 every time.

Well it happens to me, i don't know if it is an isolated case.

0
votes

If you have 64 bit distro, install 32 bit deps: sudo apt-get install -y lib32gcc1 libc6-i386 lib32z1 lib32stdc++6 sudo apt-get install -y lib32ncurses5 lib32gomp1 lib32z1-dev