简体   繁体   中英

Cause: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling

I created an Apache Cordova project via the command-line (cordova create app com.app.app app) and added the Android platform (cordova platform add android). I then attempted to import the build.gradle file from this project into Android Studio, but when I try to import after selecting my Gradle directory, I receive the above error. I have Android Studio 1.0.2 and Gradle 1.10. Does anyone know how to fix this error? Please help! Thank you in advance.

When you create project, it is created with an old android gradle plugin version (i think it's 0.10) which requires Gradle 1.10. Android Studio 1.0.2 comes with Gradle 2.x. If you want to get it work, change the android gradle plugin version to com.android.tools.build:gradle:1.0.1 in the build.gradle from root and cordovaLib folder (both).

By the way, after doing this, you will have problems with android sdk. Build.gradle comes with buildToolsVersion "19.0.0" and you should use buildToolsVersion "19.1.0" also in both projects. And another tip, the min sdk version should be 10 for both too. I had to change it too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM