Tuesday, December 15, 2015

Google AppEngine : From Eclipse to Android Studio

So recently I decided to take another look at Android Studio and migrate my most involved App (Follow Chess). Follow Chess uses several "shared libraries" and ofcourse the connected AppEngine project.

In this post I will only talk of the two most important things which were required for me to migrate the Eclipse App Engine project to Android Studio. (its assumed that the App engine project has already been added to Android Studio as "module")

No Class def found errors
Its important to have the correct libraries. In my case, the following were missing and had to be added to the module's build.gradle; in addition to the usual suspects:

compile 'org.ow2.asm:asm:4.0'compile 'org.apache.geronimo.specs:geronimo-jpa_2.0_spec:1.0'compile 'org.datanucleus:datanucleus-api-jpa:3.1.3'

persistence.xml

The persistence.xml file should be copied over to <module>/src/main/resources/META-INF/ directory. By default the resources folder did not exist, so I had to create one.
If this is not done and the xml is not available to the project, then at the run-time, there would be errors in Server logs (complaining that persistence.xml could not be found)

Enhance classes
The entity classes need to be enhanced. If this is not done, then you would usually see errors in server logs:
MetaDataManager initialiseFileMetaDataForUse: Found Meta-Data for class xxxxxxxxx but this class is not enhanced!! Please enhance the class before running DataNucleus.

For this, I had to add the following to my module's build.gradle file:

enhancer {
    version = "v2"    api="jpa"    enhanceOnBuild = true}

No comments:

Post a Comment