Author Topic: Android Build Issues  (Read 849 times)

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1784
    • View Profile
Android Build Issues
« on: 2021-Sep-15 »
Hi

Just tried a new build for android for an older app that built before on the older setups...

Got this error among others for the gzwrite commands?

C:\Users\Lenovo\Documents\GL_PROJECTS\GLBasic\Space2D\distribute\android_studio\app\jni\zlib\gzwrite.c:89:20: warning: implicit declaration of function 'write' is invalid in C99 [-Wimplicit-function-declaration]

Any idea if an update caused this?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline SnooPI

  • Dr. Type
  • ****
  • Posts: 415
    • View Profile
Re: Android Build Issues
« Reply #1 on: 2021-Sep-15 »
Probably a problem with #include <unistd.h>

Add it with the INLINE function at the start of your code.

But there will surely be another problem because the ZLIB has an API C.
« Last Edit: 2021-Sep-16 by SnooPI »

Offline Qedo

  • Dr. Type
  • ****
  • Posts: 350
  • to program what I have todo how should I program?
    • View Profile
Re: Android Build Issues
« Reply #2 on: 2021-Sep-16 »
I can not help you. Since compiling with android studio i have never been able to build. By the way, if anyone of good will wanted to write a mini tutrial, he would be welcome.  :giveup:

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1784
    • View Profile
Re: Android Build Issues
« Reply #3 on: 2021-Sep-16 »
So previously I was able to build fine etc.
But some new update must have changes items in the jni/src and jni/zlib
and probably others...

Also, the app gradle file was missing a top reference...

def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');

SF,Gernot was there an update to the android build or c++ sources recently (few months or so)
its been a awhile since i built a new project.
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1784
    • View Profile
Re: Android Build Issues
« Reply #4 on: 2021-Sep-16 »
I can not help you. Since compiling with android studio i have never been able to build. By the way, if anyone of good will wanted to write a mini tutrial, he would be welcome.  :giveup:

I did a few posts and SF did some others ...
Heres mine
https://www.glbasic.com/forum/index.php?topic=11356.0
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline Qedo

  • Dr. Type
  • ****
  • Posts: 350
  • to program what I have todo how should I program?
    • View Profile
Re: Android Build Issues
« Reply #5 on: 2021-Sep-16 »
MrPlow  thank you, i will try.

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1784
    • View Profile
Re: Android Build Issues
« Reply #6 on: 2021-Sep-20 »
I managed a build but android assets sprites, sounds and fonts not working ....
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1784
    • View Profile
Re: Android Build Issues
« Reply #7 on: 2021-Sep-21 »
Fonts working now - only sound is not loading...
[update ; fyi - I needed to replace the newer jni source files and glbasic files with ones from when my android compile was working - as the gzwrite and other bugs were failing to build on a new project.]
« Last Edit: 2021-Sep-21 by MrPlow »
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1784
    • View Profile
Re: Android Build Issues
« Reply #8 on: 2021-Sep-21 »
Hi

For those interested the compile issues are now resolved - managed to fix by using compile sdk 30, with targetsdk at 30 minsdk at 23

Last issue was sound and that is resolved now... =D
 

However the templates for android that come with the newest version will need fixing to work for others - I have older libraries was able to restore them for the new project which fixed my issues
« Last Edit: 2021-Sep-21 by MrPlow »
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
Re: Android Build Issues
« Reply #9 on: 2021-Sep-24 »
its might have mixed in old and new version? im havent checked in a while. target sdk 30 is android 11.

IM did inddeed have most focus on the Spectrum Next game currectly.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1784
    • View Profile
Re: Android Build Issues
« Reply #10 on: 2021-Oct-06 »
Thanks SF,
In terms of the src file changes that affect the Android builds - are the android templates src files version controlled so that older files or rollbacks can be obtained if required?

Can advance notice be made on the updates so I dont suddenly build any broken versions :)

I do normally test the apps - but things like controller setups etc. wouldnt be tested each time.
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1784
    • View Profile
Re: Android Build Issues
« Reply #11 on: 2021-Oct-15 »
SF,

I know your busy but some file issues on android builds i need to fix...

Can you advise where to put Android.xcl file to prevent overrites?

Also is just deleting jni folder required before a rebuild with newer files?
Or do i need to remove another folder too?

Thks
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
Re: Android Build Issues
« Reply #12 on: 2021-Oct-17 »
ioh no. Newer Android Studio has broken thing again. This is why im gave up Android as well iOS in first  time!

Currectly im cannot get android Studio working fully. one major block is Android Studio is so stupid programmed as its cant uses usernames with a space... ahhhh. so im can not countinue and will wait a another day. Android Studio is uninstalled again.

Im also not want to reinstalle the whole windows one time due this crappy issue.

Also what im found up until im uninstalled is JCENTER() is depreacted in grandle.build (but they well keep it as read only in the future), but cause issues when removed it. ALso both grandle and grandle plugin is require to uses a newer version than that we uses or the NDK would not been downloaded and installed at all! Last time im tried its, its caused various compiler issues.

So its a another crappy cat vs mouse game again. That is why im in first place also gave up android as well.

IF im cannot get Android Studio to installed a another place without requireng to uses the username by default, then im cannot do anything at all. Its a very crappy issue.

EDIT: its ANDROID SDK that should not been installed in a username with a space. its dont like it and should have warn about it in first place.
« Last Edit: 2021-Oct-17 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3956
    • View Profile
    • Space Fractal
Re: Android Build Issues
« Reply #13 on: 2021-Oct-17 »
anyway its looks like we need to update the project to uses a least grandle plugin version 4.2.2 and grandle version 6.7.1 me think. We cannot no longer uses a older grandle version, because its wont download the required NDK automatic.

Also you need to add a android:exported="true" under the <activity android:name="SDLGlbasic" in AndroidManifest.

Im havent checked yet, so no idea what its coming up with errors.

Currectly im got it compiiled, but still does not launch (crash out).....
« Last Edit: 2021-Oct-17 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1784
    • View Profile
Re: Android Build Issues
« Reply #14 on: 2021-Oct-28 »
But my older setup (with older jni folder)
and using 5.1.1, NDK 21.0.6113669, and Android API 30 is working a dream...and creating well-running apks :)

My SDK is installed to c:\Android\android-sdk\

dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'


Why do you need to mess with those other settings at all, when install and compiling is working using older gradle?

 =D

My working setup


Android Studio 3.5.3
Build #AI-191.8026.42.35.6010548, built on November 15, 2019
JRE: 1.8.0_202-release-1483-b03 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 7 6.1
 
For me the issues I got we just bugs in the newer jni src files - not with setup...even then, it looks like a small missing include file issue?

But just thought I would let you know Android is not broken - it can be fixed if the setup is right and the jni files are right... :)

Happy to provide more info if you need it on my setup...
« Last Edit: 2021-Oct-28 by MrPlow »
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs