# Rebuilding java classes on android branch?

**URL:** <https://discourse.libcinder.org/t/rebuilding-java-classes-on-android-branch/341>\
**Category:** Developing Cinder\
**Created:** [October 22, 2016, 8:22pm UTC](https://discourse.libcinder.org/t/rebuilding-java-classes-on-android-branch/341 "2016-10-22T20:22:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![eight\_io](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/eight_io/32/57_2.png) [@eight\_io](https://discourse.libcinder.org/u/eight_io)\
**Post date:** [October 22, 2016, 8:22pm UTC](https://discourse.libcinder.org/t/rebuilding-java-classes-on-android-branch/341/1 "2016-10-22T20:22:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rich.e](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/rich.e/32/1025_2.png) [@rich.e](https://discourse.libcinder.org/u/rich.e)\
**Post date:** [October 24, 2016, 8:39pm UTC](https://discourse.libcinder.org/t/rebuilding-java-classes-on-android-branch/341/2 "2016-10-24T20:39:24Z")

</div>

At current you need to open the Android Studio project that is [here](https://github.com/cinder/Cinder/tree/49f675a417e64d37abc79c56d1b067d00cf409ad/android/libcinder_java) (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.

---

<div class="post-metadata">

**Author:** ![eight\_io](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/eight_io/32/57_2.png) [@eight\_io](https://discourse.libcinder.org/u/eight_io)\
**Post date:** [October 25, 2016, 2:48pm UTC](https://discourse.libcinder.org/t/rebuilding-java-classes-on-android-branch/341/3 "2016-10-25T14:48:37Z")

</div>

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

```auto
./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](http://stackoverflow.com/questions/25687890/running-a-bash-command-via-cmake) describes how to call external script from cmake.

Thanks.

–8

---

<div class="post-metadata">

**Author:** ![Andrea](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/andrea/32/193_2.png) [@Andrea](https://discourse.libcinder.org/u/Andrea)\
**Post date:** [May 29, 2017, 9:29am UTC](https://discourse.libcinder.org/t/rebuilding-java-classes-on-android-branch/341/4 "2017-05-29T09:29:19Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![Andrea](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/andrea/32/193_2.png) [@Andrea](https://discourse.libcinder.org/u/Andrea)\
**Post date:** [May 29, 2017, 10:01am UTC](https://discourse.libcinder.org/t/rebuilding-java-classes-on-android-branch/341/5 "2017-05-29T10:01:20Z")

</div>

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:

> <https://gist.github.com/q-depot/ce3cc455ff34c753c05062f54adcabae>

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.

---

<div class="post-metadata">

**Author:** ![Andrea](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/andrea/32/193_2.png) [@Andrea](https://discourse.libcinder.org/u/Andrea)\
**Post date:** [May 29, 2017, 2:07pm UTC](https://discourse.libcinder.org/t/rebuilding-java-classes-on-android-branch/341/6 "2017-05-29T14:07:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rich.e](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/rich.e/32/1025_2.png) [@rich.e](https://discourse.libcinder.org/u/rich.e)\
**Post date:** [May 30, 2017, 6:10pm UTC](https://discourse.libcinder.org/t/rebuilding-java-classes-on-android-branch/341/7 "2017-05-30T18:10:55Z")

</div>

> 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!
