Rebuilding java classes on android branch?


#1

I need to make some modifications in CinderNativeActivity, Camera etc classes. I see they come within the libcinder-release.aar, libcinder-debug.aar archives, which are not rebuilt during regular cinder build.

What’s the easiest way to build these archives?

Thanks

–8


#2

At current you need to open the Android Studio project that is here (will soon be moved to the proj/android/ folder as part of a larger reorganization of project files) and build using Android Studio’s gradle support.

I agree though, ideally we can find a way to run the gradle build from cmake. I did a bit of research around this and it seems feasible to run gradle with command line arguments as a post build step, it would require someone with a bit more knowledge of gradle than myself though, to do it correctly.


#3

@rich.e At this point I am running the gradle builds from android/libcinder_java using

./gradlew assembleDebug
./gradlew assembleRelease

At first it was complaining about missing tools, but it was easy to put the right dependencies into the right places by looking at the gradlew errors.

This describes how to call external script from cmake.

Thanks.

–8


#4

I’m trying to rebuild the .aar libs, but it fails, did anything change?

Qs-MacBook-Pro:libcinder_java Q$ ./gradlew assembleDebug

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'libcinder_java'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not find org.libcinder.gradle:cinderappbuild:1.0.
     Searched in the following locations:
         https://jcenter.bintray.com/org/libcinder/gradle/cinderappbuild/1.0/cinderappbuild-1.0.pom
         https://jcenter.bintray.com/org/libcinder/gradle/cinderappbuild/1.0/cinderappbuild-1.0.jar
         file:/Users/Q/Code/Cinder/proj/tools/android/CinderAppBuild/repo/cinderappbuild-1.0.jar
         file:/Users/Q/Code/Cinder/proj/tools/android/CinderAppBuild/repo/cinderappbuild.jar
     Required by:
         :libcinder_java:unspecified

#5

the problem was with the path in the build.gradle that was missing a level up

dirs "${projectDir}/../../../tools/android/CinderAppBuild/repo"

I also had to change the sdk and tool versions in app/build.gradle

android {
    compileSdkVersion 21
    buildToolsVersion "25.0.3"

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }

now I’m getting a bunch of compile errors:

EDIT: I’ve commented out pretty much everything in the exampleapp, so now I can build libcinder-debug.aar and libcinder-release.aar, however it looks like the compiled libs are missing everything, the size is only 11K(cinder libs are 80K) also when I run the gradlew it always build both aar files no mater what assemble option I use.


#6

I think I’ve figured it out, the problem was again a missing level-up in the paths in build.gradle. I’ll tidy up and make a PR


Looking for some guidance on how Android Apps are built
#7

I think I’ve figured it out, the problem was again a missing level-up in the paths in build.gradle. I’ll tidy up and make a PR

Please do, thanks for tackling this!