GLBasic forum

Main forum => GLBasic - en => Topic started by: D2O on 2022-May-06

Title: Android Studio error in creating app.
Post by: D2O on 2022-May-06
Hello, when creating an Android app,
I get the following errors displayed.
Does anyone know what that could be?

Thanks.

https://www.glbasic.com/forum/index.php?action=dlattach;topic=11538.0;attach=8378;image (https://www.glbasic.com/forum/index.php?action=dlattach;topic=11538.0;attach=8378;image)
Title: Re: Android Studio error in creating app.
Post by: MrPlow on 2022-May-07
Is this a new error - have you managed to create apk already before now?

Title: Re: Android Studio error in creating app.
Post by: D2O on 2022-May-07
With Android Studio and with the GLB Steam version
not yet.
With the older version yes.
I reinstalled GLB and AS here.
But AS on the D: HDD.
The path to AS has been adjusted.
AS starts, Gradle starts, but then this error message comes up.

Does AS have to be adjusted, or does it need a special one
SDK/NDK?
Title: Re: Android Studio error in creating app.
Post by: MrPlow on 2022-May-12
I myself have this setup:

C:\Android\android-sdk

SDK 31.0.0
Android platform tools 29.0.6
SDK Tools 26.1.1

Says I dont have NDK installed - but not 100%
Title: Re: Android Studio error in creating app.
Post by: MrPlow on 2022-May-12
API 31
Android SDK platform 31
Android SDK platform 30

been a while - but i managed to create apk just now

Make sure you asset icons are present for the res> folder

Create using AS - new asset options...
Title: Re: Android Studio error in creating app.
Post by: MrPlow on 2022-May-13
also...
example of part of my app config...

android {
    compileSdkVersion 30
    defaultConfig {
        if (buildAsApplication) {
            // GLBASIC_USER_NOTE applicationId
            // Here, GLBasic will put your company and app name.
            // The string for the launcher icon is in
            // app/src/main/res/values/strings.xml
          //  applicationId "com.gazzappergames.centiplode.centipedeshooter"
            applicationId "com.gazzapper.pillarfight.shooter"
        }
        // GLBASIC_USER_NOTE versionCode, versionNumber, target SDK
        minSdkVersion 23
        targetSdkVersion 30

        // version to detect when installing. Must be incresed for each app-store build.
        versionCode 1

        // version as shown to the user
        versionName "1.01"

        externalNativeBuild {
            ndkBuild {
                arguments "APP_PLATFORM=android-23"
                abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
            }
        }
...
etc etc.


Remember to keep gradle 3.4.1
at least mine is still on 3.4.1
Title: Re: Android Studio error in creating app.
Post by: D2O on 2022-May-13
Info
Upload: 13-May-2022
Expires: 10-Jun-2022


My AS config:
http://snap.ashampoo.com/H4QccDlpAFVbFUibd9RQQpUcr69LAPeix6GS97heMd2s3xJ05nHNCO3LNcLuc0wG (http://snap.ashampoo.com/H4QccDlpAFVbFUibd9RQQpUcr69LAPeix6GS97heMd2s3xJ05nHNCO3LNcLuc0wG)

Build sample:
http://snap.ashampoo.com/EKiVkU6zq1cX8XImO2cWPoyN5DteangRvlxT5YVFr7L5Q5BK1lhk9m3HWmfDvkBm (http://snap.ashampoo.com/EKiVkU6zq1cX8XImO2cWPoyN5DteangRvlxT5YVFr7L5Q5BK1lhk9m3HWmfDvkBm)


:'(
Title: Re: Android Studio error in creating app.
Post by: MrPlow on 2022-May-13
My output window shows:

NDK Resolution Outcome: Project settings: Gradle model version=5.1.1, NDK version=21.0.6113669
Title: Re: Android Studio error in creating app.
Post by: MrPlow on 2022-May-13
try remove that androidx dependancy - i dont use it at all?
i have it commented out...
Title: Re: Android Studio error in creating app.
Post by: MrPlow on 2022-May-13
There are many things to check for app to build...

- androidmanifest - correct and format is correct
- sdk, ndk and gradle settings libraries etc.
- dependancies

when I have time i will try replicate your test...to see if i get errors too...
Title: Re: Android Studio error in creating app.
Post by: MrPlow on 2022-May-18
Hi, i also managed to create an Android aab bundle with minsdk 23 and targetsdk 30

Wouldn't work but found a solution...

to edit the SDLActivity code - comment out the return command like below and add return library;

Code (glbasic) Select
protected String getMainSharedObject() {
        String library;
        String[] libraries = SDLActivity.mSingleton.getLibraries();
        if (libraries.length > 0) {
            library = "lib" + libraries[libraries.length - 1] + ".so";

        } else {
            library = "libmain.so";
        }
        return library;
        //return getContext().getApplicationInfo().nativeLibraryDir + "/" + library;

    }
Title: Re: Android Studio error in creating app.
Post by: D2O on 2022-May-19
@MrPlow,

Thank you for your support.
Regarding the commented out code.
Where is it in?
Title: Re: Android Studio error in creating app.
Post by: MrPlow on 2022-May-20
Quote from: D2O on 2022-May-19
@MrPlow,

Thank you for your support.
Regarding the commented out code.
Where is it in?

SDLActivity.java file under org.libsdl.app folder under java folder

I also gave someone on this forum, my version of my working JNI folder - as they were having errors creating with the newer default app > jni folder files...