问题
I'm using the new gradle build switch when sending an Android build for Codename One. One of the highlighted benefits of building with gradle is the ability to open/run in Android Studio and indeed the project opens for me but I'm getting the following error:
Error:Unable to load class 'org.codehaus.groovy.runtime.StringGroovyMethods'. Possible causes for this unexpected error include:
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
- Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
- The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
- Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
I restarted the process, the IDE and did quite a few things with no real success.
回答1:
I had the exact same issue and corresponded with Codename One support a while back and it turns out the solution is rather simple:
Define your own installation of gradle as the one to use, this is what Chen from CodenameOne sent to me as a reference:
I installed gradle 2.8 and configured it as such in the settings and that almost worked. I also had to follow the instructions of Android Studio - supplied javaHome is not a valid folder & even After update of AS to 1.0, getting "method ID not in [0, 0xffff]: 65536" error in project despite the fact that multi-sex was not necessary in the server?
来源:https://stackoverflow.com/questions/34430404/how-to-build-the-native-android-sources-from-codename-ones-build-server