Wizard generated start programs don’t work on Android

I can’t seem to get even the simplest things to work and extract any information that I can do a useful search on.
I am looking around for a cross platform development tool for my audio and animation program and thought I would try out JUCE to see if it has what we need.
So far I can’t get most of the wizard generated code to even compile. And I have been fighting with it all week. It must be a simple thing and I am not really trying to do very much.
The GUI application run on visual studio 2017 but not on android studio. The Animation application files on both platforms also failed.
Here is what happens when I try to build the GUI application and run it on android.
This is on a windows 7 64 bit system.
I down loaded JUCE from the web site and put the decompressed folder at the root of the C drive. And then I ran the program called Projucer.exe.
Was there anything else I needed?
Clicked GUI application
Named project text_3 (bug could not paste a name in had to type it, control v but my mouse that has control v on it does not work, never seen this bug before)
Project folder C:\Users\Andre\Juce experiments
Selected visual studio 2019 and Android both of which are working and up-to-date
Create happened without error
Selected android studio
Got this message:
The path
‘C:\Users\Andre\Library\Android\sdk’
does not belong to a directory.

Android Studio will use this Android SDK instead:
‘C:\Users\Andre\AppData\Local\Android\sdk’
and will modify the project’s local.properties file.
Hit ok
Go this error message
ERROR: NDK not configured.
Replace ndk.dir in local.properties with C:\Users\Andre\AppData\Local\Android\sdk\ndk-bundle
Note I was able to create and run an NDK project from android studio without problem just a few days ago and but not this.
I clicked on the suggested repair.
Now it says
Plugion Update Recommended
Android Gradle Plugin is ready to update
I am going to ignore this, this time around.
My Android phone is attached, and correctly configured for development as I have been using for months on and off and even ran the NKD app two days ago on it.
Press run (the green triangle)
I get 2 windows full of errors:
Build output
build failed 6 s 247 ms
Run build 5 s 214 ms
Load build 9 ms
Configure build 453 ms
Calculate task graph 133 ms
Run tasks 4 s 525 ms
:app:checkDebug_DebugClasspath 55 ms
:app:preBuild 1 ms
:app:preDebug_DebugBuild 2 ms
:app:compileDebug_DebugAidl
:app:compileDebug_DebugRenderscript 5 ms
:app:checkDebug_DebugManifest 2 ms
:app:generateDebug_DebugBuildConfig 6 ms
:app:prepareLintJar 3 ms
:app:mainApkListPersistenceDebug_Debug 3 ms
:app:generateDebug_DebugResValues 2 ms
:app:generateDebug_DebugResources
:app:mergeDebug_DebugResources 31 ms
:app:createDebug_DebugCompatibleScreenManifests 6 ms
:app:processDebug_DebugManifest 59 ms
:app:splitsDiscoveryTaskDebug_Debug 2 ms
:app:processDebug_DebugResources 399 ms
:app:generateDebug_DebugSources
:app:javaPreCompileDebug_Debug 14 ms
:app:compileDebug_DebugJavaWithJavac 3 s 740 ms
:app:generateJsonModelDebug_Debug 27 ms
:app:externalNativeBuildDebug_Debug 115 ms
Execute build 112 ms
Null

And the other window
Has + to open up stuff if I open it and copy it over I get all this:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:app:externalNativeBuildDebug_Debug’.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.gradle.internal.UncheckedException: Build command failed.
Error while executing process C:\Users\Andre\AppData\Local\Android\sdk\cmake\3.10.2.4988404\bin\cmake.exe with arguments {–build C:\Users\Andre\Juce experments\Test_3\Builds\Android\app.externalNativeBuild\cmake\debug_Debug\arm64-v8a --target juce_jni}
Unknown argument experments\Test_3\Builds\Android\app.externalNativeBuild\cmake\debug_Debug\arm64-v8a
Usage: cmake --build [options] [-- [native-options]]
Options:

= Project binary directory to be built. --target = Build instead of default targets. May only be specified once. --config = For multi-configuration tools, choose . --clean-first = Build target 'clean' first, then build. (To clean only, use --target 'clean'.) --use-stderr = Ignored. Behavior is default in CMake >= 3.0. -- = Pass remaining options to the native tool.
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:76)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:801)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:768)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
... 34 more

Caused by: Build command failed.
Error while executing process C:\Users\Andre\AppData\Local\Android\sdk\cmake\3.10.2.4988404\bin\cmake.exe with arguments {–build C:\Users\Andre\Juce experments\Test_3\Builds\Android\app.externalNativeBuild\cmake\debug_Debug\arm64-v8a --target juce_jni}
Unknown argument experments\Test_3\Builds\Android\app.externalNativeBuild\cmake\debug_Debug\arm64-v8a
Usage: cmake --build [options] [-- [native-options]]
Options:

= Project binary directory to be built. --target = Build instead of default targets. May only be specified once. --config = For multi-configuration tools, choose . --clean-first = Build target 'clean' first, then build. (To clean only, use --target 'clean'.) --use-stderr = Ignored. Behavior is default in CMake >= 3.0. -- = Pass remaining options to the native tool.
at com.android.build.gradle.tasks.ExternalNativeBuildTaskUtils.executeBuildProcessAndLogError(ExternalNativeBuildTaskUtils.java:245)
at com.android.build.gradle.tasks.ExternalNativeBuildTask.executeProcessBatch(ExternalNativeBuildTask.java:307)
at com.android.build.gradle.tasks.ExternalNativeBuildTask.build(ExternalNativeBuildTask.java:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
... 47 more

I tried it again and this time it downloaded something but it crashed immediately. I tried it running debugger.
Now I get a
Signal = SIGTRAP (signal SIGTRAP)
this = {juce::String * | 0x7fef39fbb0} 0x0000007fef39fbb0
t = {const signed char *const | 0x7785f88464} 0x0000007785f88464
juce::newLine = {juce::NewLine}
juce::emptyString = {const juce::EmptyString}
and it stops on this line
jassert (t == nullptr || CharPointer_ASCII::isValidString (t, std::numeric_limits::max()));
}

I installed juce, visual studio and android studio on a new windows 10 machine and setup an android emulator instead of my phone. The same thing happens: it crashes at this line:

jassert (t == nullptr || CharPointer_ASCII::isValidString (t, std::numeric_limits< int >::max()));

In the function String::String ( const char * const t)

In the file: juce_String.cpp

I have followed all the instructions I could find and not changed any of the code.

Does Juce actually support android anymore?

If so how can I make it work?
Are there some up to date instructions some where?
What am I doing wrong?
Help !

It looks as though the android OS is passing in something that is not a regular ascii character. I am loathed to modify libraries I don’t understand to try to fix this.

Not that I knew much about Android, and I do my development on OSX, but I have trouble following your thoughts:

  • when you say “it crashes”, do you mean the building? Or the running the project you just built? Or the Projucer?

  • the assert you posted:
    jassert (t == nullptr || CharPointer_ASCII::isValidString (t, std::numeric_limits< int >::max()));
    Can you give the line in the code, where that is located?
    And can you add the call stack? In German we call this situation “the child fell already into the well”, the call stack would tell more, where things went wrong…

@andremilota What you are experiencing has already been reported here: String assertion in android build

The simplest solution is to change “Push Notifications Capability” from “Default (Enabled)” to “Disabled” in the Android exporter and then re-save your project (all of that in Projucer).

@McMartin has your answer :slight_smile: