Problem building The demo app


#1

Hello,

I just tried to build the Demo application for Android with the latest Juce tip and I got the following error:

[exec] Compile++ thumb  : juce_jni <= ApplicationStartup.cpp
     [exec] Compile++ thumb  : juce_jni <= MainDemoWindow.cpp
...
     [exec] Compile++ thumb  : juce_jni <= JuceLibraryCode4.cpp
     [exec] Prebuilt       : libstdc++.a <= <NDK>/sources/cxx-stl/gnu-libstdc++/libs/armeabi/
     [exec] SharedLibrary  : libjuce_jni.so
     [exec] /Users/michaelh/Code/juce/extras/JuceDemo/Builds/Android/obj/local/armeabi/objs/juce_jni/../../../Source/demos/InterprocessCommsDemo..o:(.data.rel.ro._ZTVN21InterprocessCommsDemo26DemoInterprocessConnectionE[vtable for InterprocessCommsDemo::DemoInterprocessConnection]+0x34): undefined reference to `non-virtual thunk to juce::InterprocessConnection::handleMessage(juce::Message const&)'
     [exec] collect2: ld returned 1 exit status
     [exec] make: *** [/Users/michaelh/Code/juce/extras/JuceDemo/Builds/Android/obj/local/armeabi/libjuce_jni.so] Error 1

Can somebody point me in the right direction to solve this error?
I’m building this on Snow Leopard, with a recent Android SDK and NDK r5b.

Thanks,

Michaël

edit: mention that this is on Juce tip


#2

Hmm. Haven’t seen that one before, and the tip builds for me, using the same setup.

A non-virtual-thunk problem usually means there’s an optimisation mismatch between some of your compiled modules. Did you try cleaning it and running ant again? Is this with “ant debug” from the command line?


#3

After deleting the Android folder and regenerating the project with IntroJucer the project builds.
First I ran ‘ant clean’ before building with ‘ant release’ but that didn’t solve the problem…

Thank you for your quick response!


#4

Ok… I just managed to reproduce the thunk problem, by running “ant clean”.

So it looks like “ant clean” doesn’t work properly, and I suspect it’s probably doing something stupid and actually causing the problem. Try just deleting the obj directory to clean it, and it should work. (I actually use a shell script to clean my intermediate files, so didn’t realise this was broken).


#5

Hi Jules,

first of all i want to say you are doing really a fantastic job!

But i need some help to get the Juce Demo running on the Android simulator (on my Mac).
I installed eclipse, the andoid sdk and ndk and the actual Juce sources.
Then i recreated the Build/Android directory with the introjucer ( with modified the sdk pathes appropriate to my environment).
In eclipse i created a new android project from existing source, filled in the project name , chose build target android 2.3.
In the package explorer i selected the build.xml entry and right clicked “Run as …” -> “Ant build”. This compiled the libjuce_jni.so library.
After this i tried to start the Project “JuceAppActivity” by right clicking “Run as …” -> “Android application”.
This uploads “JuceAppActivity.apk” to the simulator but crashes on startup.
The debugger complains

It seems that I have missed something.
Is my description sufficient to provide me with a hint?
Best regards
l.f.


#6

I’ve sometimes found it necessary to do a ‘clean’ to force it to actually build the package (even the first time you run it), so that’s worth trying. You don’t seem to have pasted the entire error message though - what does it say is actually wrong with juce.com.JuceAppActivity ?


#7

Not so easy for me to get familiar with eclipse.
But meanwhile I found out that the shared library is not found, This happens in JuceAppActivity.java at line 56

System.loadLibrary("juce_jni");

with a ClassNotFoundException.
The JuceAppActivity.apk has about 2,36 Mb, so the library should be part of the package.
One thing during compiling the library with ant v1.8.2 is a message

[quote]Invalid attribute name:
package[/quote]


#8

ok… I’m afraid my eclipse skills are quite limited, that doesn’t ring any bells for me…


#9

Hi.

I think that the “Invalid attribute name: package” message is a red-herring. I also get this message and I think it is because Introjucer is creating the AndroidManifest.xml file with a line break in the manifest tag. If you remove the line break, the message goes away.

With or without this doesn’t seem to effect any of my builds which (most of the time) are working ok!

As nobody else has asked, you are using the latest git source of Juce (1.53) aren’t you and not 1.52???

Cheers

Phil


#10

@Phil
Thank you for clarifying. The message has gone.

The Introjucer reports 1.53.87
In Eclipse I’m using ant-1.8.2 as Runtime Environment.
Target system is Android 2.3
Any recommendations for the emulator?

Regards
l.f.


#11

Not really, I just create a basic 2.3 emulator image with no special settings.

Here is my setup:

OS X 10.6.7
Eclipse 3.7.0 using built-in ant 1.8.2 (I had problems with Eclipse 3.6.2)
Juce latest git (1.53.87)

I (loosely) followed the standard installation guide at http://developer.android.com/sdk/installing.html

Sorry I can’t really help much further as I am a bit of an Eclipse newbie as well :slight_smile:

Cheers

Phil


#12

Currently I try to use Eclipse 3.7.0 but i could not install the android sdk (produces an error during download)
But I will work oon that issue.
Best regards
l.f.


#13

Interestingly, the latest tip of Juce seems to have broken Android (unless I have done something else wrong!)

When I build and deploy the Juce Demo, it instantly force closes…

I will attempt to debug and let you know what (if anything) I find.

Cheers

Phil


#14

After dowloading the M6 build of Eclipse 3.7.0 i could install all Updates for Eclipse and ADT.
So far, so good, but deploying JuceDemo still not works.
What I saw is that in the when building the project there is no subdirectory in Builds/Android/src, so the link could not be made. The build resulted in a 19k JuceAppActivity.apk.
After creating Builds/Android/src/com, runnung a build process and recreating the Android project, the appropriate Source files are listed, and the apk has about 2.3 Mb.
The most annoying thing after this step the debugger could not connect to the emulator anymore and the session could not be established.

Best regards
l.f.


#15

Ah, the joys of android development… I’ve been busy on other stuff recently, and haven’t done an android build for a while, but will check it again today.


#16

Absolutely. I can’t believe how inconsistent the build environment is. Perhaps because I am used to Visual Studio and XCode but Eclipse+Android seems to just randomly “not work”! Sometimes I found that I would need to delete the contents of the Build directory and start again with Introjucer but at the moment I can’t get anything to work :frowning:

Cheers

Phil


#17

Sorry, I had managed to break it in the last check-in - should be ok now.


#18

I have built the demo app for Android from a mac os x host and run it on a target … pretty cool.

I am having the following problem building the same demo app from linux and windows platform:

ant debug
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar
Buildfile: build.xml

BUILD FAILED
/media/Shared_FS/Ubuntu/Work/juce/downloaded_juicer/extras/JuceDemo/Builds/Android/build.xml:12: taskdef class com.android.ant.SetupTask cannot be found

Total time: 0 seconds
dell-xps@dell-xps-laptop:/media/Shared_FS/Ubuntu/Work/juce/downloaded_juicer/extras/JuceDemo/Builds/Android$

The local properties file contains the correct path information:

sdk.dir=/media/Shared_FS/Ubuntu/android_sdk/android-sdk-linux_x86/
ndk.dir=/media/Shared_FS/Ubuntu/android_ndk/android-ndk-r5b/

Thanks for any Ant/environment pointers.