audeering / opensmile

The Munich Open-Source Large-Scale Multimedia Feature Extractor
https://audeering.github.io/opensmile/
Other
553 stars 74 forks source link

Get FAILURE: Build failed with an exception when i Compiling for Android and creating the sample Android app #36

Open tridtay opened 2 years ago

tridtay commented 2 years ago

hello , im a window 10 user with java version 15.0.2 and swig version 4.0.2. im doing a step Compiling for Android and creating the sample Android app on the https://audeering.github.io/opensmile/get-started.html im input this [gradlew opensmile:swig] on developer command line then i got this error. Error_BuildAndroid_Template.txt how to solve this problem. thank you

chausner-audeering commented 2 years ago

https://stackoverflow.com/questions/61289461/java-lang-noclassdeffounderror-could-not-initialize-class-org-codehaus-groovy-v suggests that it's related to outdated/incompatible build tool versions.

tridtay commented 2 years ago

thank you so much for first suggestion i solved by change java version to 13 in the next step after im input [gradlew opensmile:assemble -P{Aar}] to developer command line in the end of progess i got this error Error_BuildAndroid_Template.txt now im using java version 13.0.2 swig version 4.0.1 how to solve this problem. thank you

chausner-audeering commented 2 years ago

It seems it tried to run swig but it's not in the PATH. Make sure to have SWIG installed and the executable is in your PATH.

chausner-audeering commented 2 years ago

The compilation error is due to a known bug. Changing data == 0 in the line of code where the error is reported to data == null should fix it.

tridtay commented 2 years ago

i have set path and change [data == null] at the end of progess i get this error Error_BuildAndroid_Template.txt

where i change [data == null] OpenSMILEJNI.txt

Build_gradle file Build_Gradle.txt

TomAtGithub commented 2 years ago

I had the same problem and was able to solve it by changing lines 71-73 in opensmile/src/main/java/com/audeering/opensmile/OpenSMILEJNI.java to:

public static boolean SwigDirector_CallbackExternalSink_onCalledExternalSinkCallback(CallbackExternalSink jself, float[] data) {
    return jself.onCalledExternalSinkCallback(data);
}

I think the devs tried to do the same during build as described in opensmile/progsrc/android-template/opensmile/build.gradle line 18. But for some reason it did not work on my machine.:

content = content.replaceAll(/\(data == 0\) \? null : new SWIGTYPE_p_float\(data, false\)/, 'data')

I also had suffix the path with opensmile in opensmile/progsrc/android-template/opensmile/build.gradle line 16. So that it looks like this: def path = 'opensmile/src/main/java/com/audeering/opensmile/OpenSMILEJNI.java'

I tried it with: Java version: 8 (openjdk version "1.8.0_332") SWIG version: 4.0.2 Android: 9 (Kernel 3.18.120)

To make the app work I also added CMAKE_FLAGS=-DWITH_OPENSLES=ON to opensmile/progsrc/android-template/gradle.properties and set WITH_OPENSLES=ON

Now I still have this issue: https://github.com/audeering/opensmile/issues/12

chausner-audeering commented 2 years ago

@TomAtGithub Thanks a lot for sharing your findings.

I think the devs tried to do the same during build as described in opensmile/progsrc/android-template/opensmile/build.gradle line 18. But for some reason it did not work on my machine.:

I cannot reproduce this issue on my local machine, unfortunately.

I also had suffix the path with opensmile in opensmile/progsrc/android-template/opensmile/build.gradle line 16.

This one I could reproduce and your suggestion fixes it. Thanks a lot, this fix will be part of the next release.

To make the app work I also added CMAKE_FLAGS=-DWITH_OPENSLES=ON to opensmile/progsrc/android-template/gradle.properties and set WITH_OPENSLES=ON

Yes, you are right. This flag should be part of CMAKE_FLAGS.

Brandonhsu0329 commented 5 months ago

when i use cmd to implement[./gradlew opensmile:assemble],output error{ Execution failed for task ':opensmile:compileDebugJavaWithJavac'.

Failed to calculate the value of task ':opensmile:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'. Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, C:\Users\User\Desktop\opensmile-master\opensmile-master\progsrc\android-template\opensmile\build\generated\ap_generated_sources\debug\out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@3f2a6647) before task ':opensmile:compileDebugJavaWithJavac' has completed is not supported } @chausner-audeering please help me :(