15

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.

IgorGanapolsky
  • 26,189
  • 23
  • 116
  • 147
tiny sunlight
  • 6,231
  • 3
  • 21
  • 42

6 Answers6

3

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

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
Sufian
  • 6,405
  • 16
  • 66
  • 120
2

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

sivi
  • 10,654
  • 2
  • 52
  • 51
  • 1
    All is right now. I just need to disable instant run.I hope google will fix it in new version of Android Plugin.I will try alpha 7. – tiny sunlight Jan 24 '16 at 14:20
  • I was having an issue with the alpha7 so I gave this solution because it took me a lot of time to figured out. I also movef away from canary to dev for now – sivi Jan 24 '16 at 15:20
  • 1
    Current latest settings: Gradle version: 2.12 Android Plugin Version: 2.0.0-beta7 – Igor Gorjanc Mar 22 '16 at 08:56
  • it changes very often so be sure that the right version is used. I think now it updates automatically. – sivi Apr 07 '16 at 07:12
1

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

Community
  • 1
  • 1
Kishan Vaghela
  • 7,678
  • 5
  • 42
  • 67
1

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.

GuilleGlad
  • 21
  • 2
0

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

Fabien Thetis
  • 1,666
  • 15
  • 11