build script for Android native builds

Hello,
Finally, we migrated from old Ant native build system to Android Studio :slight_smile: I have a question about that! On Previous build system(old corona enterprise) there was and “build.sh” script for Android platform that we used it on our custom build script for building apk files on an automated build system(Jenkins). And my question is:

Is there a script like old ‘build.sh’ in Corona Native/Android Studio that I can use it for my building process?!

Thanks

Hi @alireza.poorsohoolat,

I’m not an expert on native Android dev matters, but did you check to see if the contents of this folder contain what you need?

Corona > Native > Project Template > App > android

Brent

Thanks for your response Brent.

There are two files: gradlew.bat and gradlew(unix executable file).
I executed “gradlew” file and it started to download/install gradle dependencies(a lot of unknown jar file from jCenter domain).
In previous versions(ant system), We simply execute “build.sh” in our build script.
I don’t know what are these two scripts. Let me research more about gradle mechanism, if I had an update, I will share.
 

Just slightly off topic: the presence of “gradlew.bat” is a promising sight… can we expect a Corona Native development environment on Windows? At least for Android and Win32 development?

Native Android builds for Windows is something we want to do, but it’s still a sizable task. 

Rob

Hello again, Finally I prepared my build script and built an apk. :slight_smile: after opening apk on test device i get this error:

WARNING: Could not load ‘network.LuaLoader’
java.lang.ClassNotFoundException: network.LuaLoader

?:0: attempt to index field ‘network’ (a nil value)

In my build.gradle I have this line:
compile fileTree(dir: “$coronaEnterpriseAndroidLibDir/libs”, include: ‘*.jar’)

I think this line will added needed jar files like network.jar and … to the project. nah?

additional note: I use last public release of corona and multidex is enabled on gradle script.
Update: App works perfect on Android 5 and above! error only happened on android 4(different versions: 4.1.2, 4.3)
what can i do?
 

Any response?

Hi again,

You stated that you want to convert an older Ant-based Enterprise project to Corona Native, correct? So then you are using at least build 3100 or higher right? If you’re using 3068 (latest public release), that pre-dates Corona Native… perhaps we have a minor miscommunication on versions in this chat?

Brent

Hello Brent,
Yes I migrated to Corona Native(android studio build system) from Ant build system and my problem solved.
I don’t know why mentioned problem occurred but it solved by extending “CoronaApplication” class from “MultiDexApplication” instead of “Application” :slight_smile: I think Corona should update its documentation about it.

Anyway thanks for your response.
 

Hi @alireza.poorsohoolat,

Thanks for the update! As I mentioned, Corona Native isn’t my specialty, but would you like to see this document updated?

https://docs.coronalabs.com/native/android/index.html

If yes, specifically what do you think needs to be clarified?

Thanks,

Brent

Hi @alireza.poorsohoolat,

I’m not an expert on native Android dev matters, but did you check to see if the contents of this folder contain what you need?

Corona > Native > Project Template > App > android

Brent

Thanks for your response Brent.

There are two files: gradlew.bat and gradlew(unix executable file).
I executed “gradlew” file and it started to download/install gradle dependencies(a lot of unknown jar file from jCenter domain).
In previous versions(ant system), We simply execute “build.sh” in our build script.
I don’t know what are these two scripts. Let me research more about gradle mechanism, if I had an update, I will share.
 

Just slightly off topic: the presence of “gradlew.bat” is a promising sight… can we expect a Corona Native development environment on Windows? At least for Android and Win32 development?

Native Android builds for Windows is something we want to do, but it’s still a sizable task. 

Rob

Hello again, Finally I prepared my build script and built an apk. :slight_smile: after opening apk on test device i get this error:

WARNING: Could not load ‘network.LuaLoader’
java.lang.ClassNotFoundException: network.LuaLoader

?:0: attempt to index field ‘network’ (a nil value)

In my build.gradle I have this line:
compile fileTree(dir: “$coronaEnterpriseAndroidLibDir/libs”, include: ‘*.jar’)

I think this line will added needed jar files like network.jar and … to the project. nah?

additional note: I use last public release of corona and multidex is enabled on gradle script.
Update: App works perfect on Android 5 and above! error only happened on android 4(different versions: 4.1.2, 4.3)
what can i do?
 

Any response?

Hi again,

You stated that you want to convert an older Ant-based Enterprise project to Corona Native, correct? So then you are using at least build 3100 or higher right? If you’re using 3068 (latest public release), that pre-dates Corona Native… perhaps we have a minor miscommunication on versions in this chat?

Brent

Hello Brent,
Yes I migrated to Corona Native(android studio build system) from Ant build system and my problem solved.
I don’t know why mentioned problem occurred but it solved by extending “CoronaApplication” class from “MultiDexApplication” instead of “Application” :slight_smile: I think Corona should update its documentation about it.

Anyway thanks for your response.
 

Hi @alireza.poorsohoolat,

Thanks for the update! As I mentioned, Corona Native isn’t my specialty, but would you like to see this document updated?

https://docs.coronalabs.com/native/android/index.html

If yes, specifically what do you think needs to be clarified?

Thanks,

Brent