Application Validation Error / Incorrect splash screen

As far as PC support goes, we are discussing that vs. other big ticket items. I may know more soon on that. It’s definitely on our todo list.

Plugins for Android native builds is sort of in the same position Android native for PC’s is. We need to get it done.

Rob

Thanks Rob, I appreciate the response. So I guess my best bet is to make a plugin if I want to access Java code on Android? That should work or is there something I’m not thinking of? Thanks again!

I’m a bit confused. If you’re doing native now, you have access to a Mac. You can include native java in your project if you use Android Studio to build a native project instead of the simulator. You can also build a plugin and include the .jar file in your project if that’s more convenient. You still have to use native builds to use your own plugins.

Rob

Rob, sorry for my ignorance. You mentioned ‘You can also build a plugin and include the .jar file in your project if that’s more convenient’ m This is before submitting the plugin to Corona? Can you give us an example to how to do this?

I have developed a java file and can run native protect into Android Studio. But I can’t figure how to include the jar file to do the same. Must I compile the java file? Need some special tool? Can do this before submitting the plugin to Corona? You mentioned that, ones we have tested the plugin, we can submit it to Corona to have an special chance to test (only the developer). This jar file perhaps is this? or do you mean that can compile the jar file and use in another way? Always need the Android Studio even we use the jar file, correct? or there is another tool to compile the jar file?

Thanks so much again dear, and forgive my ignorance.

Best regards,

Are you building a plugin to submit to the marketplace? Or are you building your own app and need native functionality for it?

Dear Rob,

I’m just developing a plugin to submit to marketplace. It is more convenient for me to continue using Corona. In fact, the native code I only developing is the plugin itself for some missed function I need to use to my app.

In fact, I plan to develop some plugins. I prefer to use these plugins directly from Corona using the require statement.

Thanks again for your excellent support,

Hi, I followed all the steps to build the ProjectTemplate app folder in Android Studio…  I’m getting close I think, but when I run the apk on a device, I get an “unfortunately, app template has stopped”.   This is what’s in the logcat:

08-12 10:01:57.752 13810 13810 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate application com.mycompany.app.CoronaApplication: java.lang.ClassNotFoundException: Didn’t find class “com.mycompany.app.CoronaApplication” on path: DexPathList[[zip file “/data/app/com.mycompany.app-1/base.apk”],nativeLibraryDirectories=[/data/app/com.mycompany.app-1/lib/arm, /data/app/com.mycompany.app-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]

Any ideas?  The rest of the logcat around that time is in the attached txt file.

Thanks again for your help.

John 

Did you try to add your own file or did you edit the existing one?

Rob

Hi Rob,  Actually the only change I made was to add System.out.println(“in onLoaded”); in the CoronaApplication.java onLoaded method so that I could follow along how it processes.  I’ll make a new copy of the /Project Template/App/ folder and try again with the clean copy.  I’ll also try the ‘clean project’ feature in Android and see if that helps.  From what I read online maybe this has to do with package names, but they seem to all be referenced ok (if I’m understanding them correctly anyway)

I’ll post here what happens when I try the above

Thanks again. 

Oh wow, a brand new copy of that folder worked. My guess is the other apk must have needed a ‘clean build’ first. I had fought with getting that one to run in the android emulator with no luck. Maybe all that trying and retrying of different things messed it up somehow. This time I just simply made a copy of   /Project Template/App/ and did nothing but did Build > Build apk on the /android/app/ folder. via Android Studio. I then used google drive to get the apk onto the phone (since the mac was giving me trouble seeing my device via the usb cable).  Installing this new apk worked and I got the Corona dictionary page with no errors that I could see.  

Thanks again for you superb customer service Rob

Glad you’re going!

To help others if they are new to Android, these are the steps I followed that worked:

1.   Use Finder to make a new copy of the /app/ folder found at /Applications/Corona/Native/Project Template/ app /) and use that copy for the below

 

  1.   Go into Android Studio and click "Open an existing Android Studio Project’ (that option comes up in the Android Studio ‘Welcome to Android Studio’ popup window). Browse to the /android/ folder under the /app/ folder of the copy you made in the above step, Click OK

  2.   In Android Studio use the top menu to select Build > ‘Build apk’ in order to build the apk.  If your emulator or usb device connection aren’t working, get the resulting apk to your device by uploading it to Google Drive (or any cloud storage) and download and install it on your device from there.  (The apk that gets built and needs to be installed on your device can be found here after you ‘build’ it: /android/app/build/outputs/apk/app-debug.apk )

 

 

Maybe this or some version of this can be added to the Corona Native docs to help others that are new to Android development 

Thanks Rob for all your help, couldn’t have made it happen without your insights!

By the way, has anyone gotten it to work on an Android Virtual Device? If so, can you possibly post the steps here?  Android Studio seems to have the ‘Nexus SX API 26 x86’ virtual device installed by default  but I kept getting failed APK installs when I click the Build/Run green triangle button.  (I’m and Android newbie though so might be my fault)

I followed these steps:

Same steps 1 and 2 above, for Step 3 I just click the green Run/Build triangle at the top of Android Studio.  

It gives me this message:

"Application Installation Failed

Installation failed with message: Failed to finalize session: INSTALL_FAILED_NO_MATCHING_ABS. Failed to extract native libraries, res=-113"

Searches online for that error message seem to point to to the fact that maybe I need to install a virtual device with an ARMEABI-V7a ?

So I did that, but that Virtual Device is extremely slow (takes something like 8 minutes to load) and fails in the end. I even get a popup that Android Studio strongly recommends that I use an x86 virtual device instead and that it “will be 10x faster”

Is there an Android Studio virtual device that anyone got Corona Native working with?  I’m running Android Studio 2.3.3 that says it was built on June 6, 2017. Thanks

When building Android Native apps, your plugin files (.jar, .so) need to go into your:

App/android/app/src/main/jniLibs/armeabi-v7a

folder.

Rob

Hi,

I see that the docs at

https://docs.coronalabs.com/native/android/index.html
say “libs/ — This is where third-party (Corona) .jar plugins that your app relies upon should go.”

I didn’t see an existing /lib/ folder in my copy of the project template (is that correct, there is no /lib/ folder there?), so I created one and ended up with this full path

/Users/jm/Documents/TEST300/App/android/app/libs/

TEST300 is where I"m storing this project

I open Android Studio and select ‘open existing android studio project’ and select /android/ from the above path.

I do build > build apk to verify that when this project is untouched that it builds ok. No errors - it says build successful.

I dropped a Corona 3rd party plugin .jar into that /Users/jm/Documents/TEST300/App/android/app/libs/ folder.

in Android studio I then do a build > build apk, but get this error now when building:

 

Information:Gradle tasks [:app:assembleDebug, :plugin:assembleDebug]
Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lplugin/library/BuildConfig;
Information:BUILD FAILED

I also tried doing build > clean project and then build > build apk but get the same error

Do the above steps work for you?  Am I doing something wrong? Is there a change I need to make to the Gradle Script? Or is the debug keystore the problem?

Thanks so much.

John

Hmmmm. A couple of google searches on the multiple dex files error seems to point to package names.  It seems the plugin .jar is using plugin.library as the package name but doesn’t let me change it because it is compiled. So I’ll try refactoring the  /Users/jm/Documents/TEST300/App/android/plugin/src/main/java/plugin/library/ folder to something like …/plugin/library2/ and see if that helps.

Let me see if I can get someone with a little more experience using Android Studio to answer the question.

What plugin are you adding to the project? 

Are you trying to build the plugin sub-project?

Thanks

Rob

It seems to build successfully now after refactoring that /Users/jm/Documents/TEST300/App/android/plugin/src/main/java/plugin/library/ folder to library2. (although I haven’t yet deployed to a device to test the apk runs ok)

In order to get it to build I had to remove 2 of the 8 plugins that the app needs (But I need to somehow get them back in and working)

Those 2 plugins continue to cause the Multiple dex files error since they both seem to have “package plugin.library” in their BuildConfig file. Android Studio lets me see the file by decompiling it from the jar but it doesn’t seem to let me change it. 

I see this file in : /libs/plugin.externalStorage.jar > plugin > library > BuildConfig (at the top of the editor window it says "decomplied .class file, bytecode version 51.0 Java 7)

Is there any way to change the package in that file? or way to get the build to accept it? or another way to prevent getting a Multiple dex files error?

Thanks Rob I see you wrote as I was typing up my last post. I can’t seem to get these 2 plugins to work together:

plugin.externalStorage.jar

plugin.equalizer.jar

They are both by the same plugin developer

They both have in the decomplied BuildConfig this: “package plugin”.library which seems to cause the multiple dex files error.

I pasted these jars along with the other 6 into the following folder, so I’m using the /app/ not the /plugin/ module:

/Users/jm/Documents/TEST300/App/android/ app /libs/

I had to create the libs folder for some reason, I don’t see it in the projectTemplate. If I have that wrong please let me know.

Thanks again