Errors when compile Android app

Just starting out? Need help? Post your questions and find answers here.
Madmix
Posts: 14
Joined: Fri Feb 14, 2025 11:16 am

Errors when compile Android app

Post by Madmix »

My code works fine in the ide, but when I compile it for android I get in my phone a black screen and then the app closed automatically

I'm using JDK 17, defined in SpiderBasic compiler path: "C:\Program Files\Java\jdk-17\"

this log says:
  • ANDROID_SDK_ROOT=undefined (DEPRECATED)
  • Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

Code: Select all

Compilation in progress...
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Creating a new cordova project.
Creating app...
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Using cordova-fetch for cordova-android@14.0.1
Adding android project...
Creating Cordova project for the Android platform:
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@14.0.1
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Installing "cordova-plugin-nativeaudio" for android
Adding cordova-plugin-nativeaudio to package.json
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Checking Java JDK and Android SDK versions
ANDROID_HOME=D:\Program\SpiderBasic\Android\android\sdk (recommended setting)
ANDROID_SDK_ROOT=undefined (DEPRECATED)
Using Android SDK: D:\Program\SpiderBasic\Android\android\sdk
Picked up _JAVA_OPTIONS: -Xmx512M
> Task :wrapper
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Picked up _JAVA_OPTIONS: -Xmx512M
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
> Task :app:generateDebugBuildConfig
> Task :CordovaLib:preBuild UP-TO-DATE
> Task :CordovaLib:preDebugBuild UP-TO-DATE
> Task :app:javaPreCompileDebug
> Task :CordovaLib:writeDebugAarMetadata
> Task :app:generateDebugResValues
> Task :CordovaLib:generateDebugResValues
> Task :app:checkDebugAarMetadata
> Task :CordovaLib:generateDebugResources
> Task :CordovaLib:packageDebugResources
> Task :app:mapDebugSourceSetPaths
> Task :app:generateDebugResources
> Task :app:packageDebugResources
> Task :app:createDebugCompatibleScreenManifests
> Task :app:parseDebugLocalResources
> Task :app:extractDeepLinksDebug
> Task :CordovaLib:extractDeepLinksDebug
> Task :CordovaLib:compileDebugLibraryResources
> Task :CordovaLib:processDebugManifest
> Task :CordovaLib:parseDebugLocalResources
> Task :app:processDebugMainManifest
> Task :app:processDebugManifest
> Task :app:mergeDebugResources
> Task :CordovaLib:javaPreCompileDebug
> Task :CordovaLib:generateDebugRFile
> Task :app:mergeDebugShaders
> Task :CordovaLib:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :app:processDebugManifestForPackage
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :CordovaLib:mergeDebugShaders
> Task :CordovaLib:compileDebugShaders NO-SOURCE
> Task :CordovaLib:generateDebugAssets UP-TO-DATE
> Task :CordovaLib:packageDebugAssets
> Task :CordovaLib:bundleLibCompileToJarDebug
> Task :app:mergeDebugAssets
> Task :app:processDebugJavaRes NO-SOURCE
> Task :CordovaLib:processDebugJavaRes
> Task :app:checkDebugDuplicateClasses
> Task :app:compressDebugAssets
> Task :app:desugarDebugFileDependencies
> Task :app:processDebugResources
> Task :app:mergeDebugJavaResource
> Task :app:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :app:dexBuilderDebug
> Task :app:mergeDebugJniLibFolders
> Task :CordovaLib:mergeDebugJniLibFolders
> Task :CordovaLib:mergeDebugNativeLibs NO-SOURCE
> Task :CordovaLib:copyDebugJniLibsProjectOnly
> Task :app:validateSigningDebug
> Task :app:mergeDebugNativeLibs NO-SOURCE
> Task :app:stripDebugDebugSymbols NO-SOURCE
> Task :app:mergeProjectDexDebug
> Task :app:writeDebugAppMetadata
> Task :app:writeDebugSigningConfigVersions
> Task :CordovaLib:bundleLibRuntimeToDirDebug
> Task :app:mergeExtDexDebug
> Task :app:mergeLibDexDebug
> Task :app:packageDebug
> Task :app:createDebugApkListingFileRedirect
> Task :app:assembleDebug
> Task :app:cdvBuildDebug
[Incubating] Problems report is available at: file:///C:/Users/ziki/AppData/Local/Temp/SpiderBasic523932906/app/platforms/android/build/reports/problems/problems-report.html
[b][color=#FF0000]Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.[/color][/b]
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.13/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 7s
50 actionable tasks: 50 executed
Built the following apk(s):
[/size]

Thank you in advance
AZJIO
Posts: 92
Joined: Wed Dec 14, 2022 1:13 pm

Re: Errors when compile Android app

Post by AZJIO »

Try renaming the folders:
C:\Users\ziki\.android
C:\Users\ziki\.gradle
When you start, new versions will be downloaded from you.
You may still have old versions from the old SpiderBasic version.
Madmix
Posts: 14
Joined: Fri Feb 14, 2025 11:16 am

Re: Errors when compile Android app

Post by Madmix »

AZJIO wrote: Wed Mar 11, 2026 2:52 pm Try renaming the folders:
C:\Users\ziki\.android
C:\Users\ziki\.gradle
When you start, new versions will be downloaded from you.
You may still have old versions from the old SpiderBasic version.
Thank you! I just did that and it did indeed download .android and .gradle again. But the result is the same. Here is the log before the app compilation window closes automatically:

Code: Select all

Compilation in progress...
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Creating a new cordova project.
Creating app...
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Using cordova-fetch for cordova-android@14.0.1
Adding android project...
Creating Cordova project for the Android platform:
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@14.0.1
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Installing "cordova-plugin-nativeaudio" for android
Adding cordova-plugin-nativeaudio to package.json
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Checking Java JDK and Android SDK versions
ANDROID_HOME=D:\Program\SpiderBasic\Android\android\sdk (recommended setting)
ANDROID_SDK_ROOT=undefined (DEPRECATED)
Using Android SDK: D:\Program\SpiderBasic\Android\android\sdk
Picked up _JAVA_OPTIONS: -Xmx512M
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :wrapper
BUILD SUCCESSFUL in 23s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Picked up _JAVA_OPTIONS: -Xmx512M
Starting a Gradle Daemon, 2 incompatible and 2 stopped Daemons could not be reused, use --status for details
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
> Task :app:generateDebugBuildConfig
> Task :CordovaLib:preBuild UP-TO-DATE
> Task :CordovaLib:preDebugBuild UP-TO-DATE
> Task :app:generateDebugResValues
> Task :app:javaPreCompileDebug
> Task :CordovaLib:generateDebugResValues
> Task :CordovaLib:writeDebugAarMetadata
> Task :CordovaLib:generateDebugResources
> Task :app:checkDebugAarMetadata
> Task :CordovaLib:packageDebugResources
> Task :app:mapDebugSourceSetPaths
> Task :app:generateDebugResources
> Task :app:packageDebugResources
> Task :app:createDebugCompatibleScreenManifests
> Task :app:extractDeepLinksDebug
> Task :CordovaLib:extractDeepLinksDebug
> Task :app:mergeDebugResources
> Task :CordovaLib:compileDebugLibraryResources
> Task :CordovaLib:javaPreCompileDebug
> Task :CordovaLib:parseDebugLocalResources
> Task :app:parseDebugLocalResources
> Task :app:mergeDebugShaders
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :CordovaLib:mergeDebugShaders
> Task :CordovaLib:compileDebugShaders NO-SOURCE
> Task :CordovaLib:generateDebugAssets UP-TO-DATE
> Task :CordovaLib:packageDebugAssets
> Task :CordovaLib:processDebugManifest
> Task :CordovaLib:generateDebugRFile
> Task :app:mergeDebugAssets
> Task :app:processDebugMainManifest
> Task :app:processDebugManifest
> Task :CordovaLib:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :app:processDebugJavaRes NO-SOURCE
> Task :CordovaLib:bundleLibCompileToJarDebug
> Task :CordovaLib:processDebugJavaRes
> Task :app:compressDebugAssets
> Task :app:desugarDebugFileDependencies
> Task :app:mergeDebugJniLibFolders
> Task :CordovaLib:mergeDebugJniLibFolders
> Task :CordovaLib:mergeDebugNativeLibs NO-SOURCE
> Task :app:checkDebugDuplicateClasses
> Task :CordovaLib:copyDebugJniLibsProjectOnly
> Task :app:mergeDebugNativeLibs NO-SOURCE
> Task :app:stripDebugDebugSymbols NO-SOURCE
> Task :CordovaLib:bundleLibRuntimeToDirDebug
> Task :app:validateSigningDebug
> Task :app:writeDebugAppMetadata
> Task :app:writeDebugSigningConfigVersions
> Task :app:processDebugManifestForPackage
> Task :app:mergeDebugJavaResource
> Task :app:processDebugResources
> Task :app:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :app:dexBuilderDebug
> Task :app:mergeProjectDexDebug
> Task :app:mergeExtDexDebug
> Task :app:mergeLibDexDebug
> Task :app:packageDebug
> Task :app:createDebugApkListingFileRedirect
> Task :app:assembleDebug
> Task :app:cdvBuildDebug
[Incubating] Problems report is available at: file:///C:/Users/ziki/AppData/Local/Temp/SpiderBasic9655750/app/platforms/android/build/reports/problems/problems-report.html
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.13/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 33s
50 actionable tasks: 50 executed
Built the following apk(s):
The apk is created and can be installed, but when you run it, it closes automatically on Android.
AZJIO
Posts: 92
Joined: Wed Dec 14, 2022 1:13 pm

Re: Errors when compile Android app

Post by AZJIO »

Madmix wrote: Wed Mar 11, 2026 6:40 pm The apk is created and can be installed, but when you run it, it closes automatically on Android.
You need to sign the application
Madmix
Posts: 14
Joined: Fri Feb 14, 2025 11:16 am

Re: Errors when compile Android app

Post by Madmix »

AZJIO, My sincere thanks for all your help, I'm stupid :!:

There was an End added at the end of the code that caused the application to terminate. It does not affect webview, but it does affect the apk, which closes it as soon as it is opened!

Last lines of my previous code :oops:

Code: Select all

.....
If OpenWindow(0, 0, 0, W, H, "", #PB_Window_Background)

  SetWindowColor(0, #COLOR_BG)

  ; Display número grande
  TextGadget(#Gad_Display, 0, 0, W, 80, Str(contador),
             #PB_Text_Center | #PB_Text_VerticalCenter)
  SetGadgetColor(#Gad_Display, #PB_Gadget_FrontColor, #COLOR_AMARILLO)
  SetGadgetColor(#Gad_Display, #PB_Gadget_BackColor,  #COLOR_BG)

  ; Botón +1 (verde, ancho completo)
  ButtonGadget(#Gad_BtnContar, 0, 0, W, 50, "<b>+1</b>", #PB_Button_MultiLine)
  SetGadgetColor(#Gad_BtnContar, #PB_Gadget_BackColor, #COLOR_BTN_MAS)

  BindGadgetEvent(#Gad_BtnContar, @CB_Contar())
  BindEvent(#PB_Event_SizeDesktop, @CB_Resize())

  LayoutGadgets()
  ActualizarDisplay()

EndIf

End
Post Reply