Android Compile error when upgrade to JUCE 4.1


#1

I try to upgrade my application from JUCE 4.02 to JUCE 4.1. After getting all the latest files from GitHub, my application was able to build and work well in Mac, Window, iOS device. When I try to build for Android using command line "ant", I got the following compile error.

Is there something I missed that I need to do when upgrading to 4.1?

 

-pre-build:

     [exec] [armeabi] Compile++ thumb: juce_jni <= juce_core.cpp

     [exec] [armeabi] Compile++ thumb: juce_jni <= juce_graphics.cpp

     [exec] [armeabi] Compile++ thumb: juce_jni <= juce_gui_basics.cpp

     [exec] [armeabi] Compile++ thumb: juce_jni <= juce_gui_extra.cpp

     [exec] In file included from jni/../../../JuceLibraryCode/modules/juce_core/juce_core.cpp:232:0:

     [exec] jni/../../../JuceLibraryCode/modules/juce_core/native/juce_android_RuntimePermissions.cpp: In function 'void juce::{anonymous}::handleAndroidCallback(bool, juce::RuntimePermissions::Callback*)':

     [exec] jni/../../../JuceLibraryCode/modules/juce_core/native/juce_android_RuntimePermissions.cpp:40:9: error: 'unique_ptr' is not a member of 'std'

     [exec]          std::unique_ptr<RuntimePermissions::Callback> uptr (callbackPtr);

     [exec]          ^

     [exec] jni/../../../JuceLibraryCode/modules/juce_core/native/juce_android_RuntimePermissions.cpp:40:53: error: expected primary-expression before '>' token

     [exec]          std::unique_ptr<RuntimePermissions::Callback> uptr (callbackPtr);

     [exec]                                                      ^

     [exec] jni/../../../JuceLibraryCode/modules/juce_core/native/juce_android_RuntimePermissions.cpp:40:72: error: 'uptr' was not declared in this scope

     [exec]          std::unique_ptr<RuntimePermissions::Callback> uptr (callbackPtr);

     [exec]                                                                         ^

     [exec] make: *** [obj/local/armeabi/objs-debug/juce_jni/__/__/__/JuceLibraryCode/modules/juce_core/juce_core.o] Error 1

     [exec] make: *** Waiting for unfinished jobs....

 

BUILD FAILED

/Users/eddie/Data/XilicaSoftware/SolaroControl/Builds/Android/build.xml:23: exec returned: 2


#2

Ah, Timur sometimes gets carried away and goes into C++11 mode.. Thanks, we'll check that.


#3

C++11 shouldn't be a problem for Android... I've used it in my Android project. It might just need to have the necessary part of the library included more explicitly. 


#4

Thanks for the help. Will wait for further advice on how to compile it.


#5

Ah, I think it's simply missing #include <memory> for the std::unique_ptr.

Android Studio didn't have a problem with that, but apparently ant does.

Should be fixed now, please update to the newest tip.


#6

Many Thanks! That solved the compile issue and all compile goes well. 

 

But one more problem at the AndroidManifest.xml file at the end of the build.

 

-code-gen:

[mergemanifest] Merging AndroidManifest files into one.

[mergemanifest] Manifest merger disabled. Using project manifest only.

     [echo] Handling aidl files...

     [aidl] No AIDL files to compile.

     [echo] ----------

     [echo] Handling RenderScript files...

     [echo] ----------

     [echo] Handling Resources...

     [aapt] Generating resource IDs...

     [aapt] /Users/eddie/Data/XilicaSoftware/SolaroControl/Builds/Android/bin/AndroidManifest.xml:13: error: Error: String types not allowed (at 'configChanges' with value 'keyboardHidden|orientation|screenSize').

     [aapt] 

 

BUILD FAILED

/Users/eddie/Data/Android_SDK/sdk/tools/ant/build.xml:649: The following error occurred while executing this line:

/Users/eddie/Data/Android_SDK/sdk/tools/ant/build.xml:694: null returned: 1

 

Total time: 10 minutes 2 seconds


#7

Hi eddie, I can't reproduce this problem here on my Mac. Are you on Linux? (and if yes, what distro/version?)

Also, nowadays the recommended way to build for Android is using Android Studio, and not ant. Did you try that?