does require( "plugin.google.iap.v3" ) need time to load?

Hi all,

I uploaded my app to Play store and in the pre-launch report, they reported a crash on 2 devices out of 9. The logcat shows:

08-21 05:56:37.429: V/Corona(12954): \< Class.forName: plugin.google.iap.v3.LuaLoader 08-21 05:56:37.429: I/Corona(12954): ERROR: Could not instantiate class (plugin.google.iap.v3.LuaLoader): Activity cannot be null. 08-21 05:56:37.429: W/System.err(12954): java.lang.IllegalArgumentException: Activity cannot be null. 08-21 05:56:37.444: W/System.err(12954): at plugin.google.iap.v3.LuaLoader.\<init\>(LuaLoader.java:63) 08-21 05:56:37.444: W/System.err(12954): at java.lang.Class.newInstanceImpl(Native Method) 08-21 05:56:37.444: W/System.err(12954): at java.lang.Class.newInstance(Class.java:1130) . . . 08-21 05:56:37.449: W/System.err(12954): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1380) 08-21 05:56:37.449: V/Corona(12954): Loading via reflection: plugin.google.iap.v3.LuaLoader 08-21 05:56:37.449: I/Corona(12954): ERROR: Runtime error 08-21 05:56:37.449: I/Corona(12954): module 'plugin.google.iap.v3' not found:resource (plugin.google.iap.v3.lu) does not exist in archive 08-21 05:56:37.449: I/Corona(12954): no field package.preload['plugin.google.iap.v3'] 08-21 05:56:37.449: I/Corona(12954): no file '/data/data/com.gameforkstudio.testapp/files/coronaResources/plugin/google/iap/v3.lua' &nbsp;

In my code I have:

 if ( "apple" == targetAppStore ) then -- iOS store = require( "store" ) elseif ( "google" == targetAppStore ) then -- Android store = require( "plugin.google.iap.v end if targetAppStore ~= "none" then -- if not on simulator store.init( transactionListener ) end

Since it happens only on a small number of devices I was wondering if it was a timing issue.

Do I need to delay calling the store.init() function for a short while or is the issue more serious?

Thanks.

I’m not aware of any timing delays, but we have some plugins that do asynchronous work in the “require” step. You could drop it in a 1 second timer to give it time. However, that looks like it couldn’t find the plugin or it couldn’t create the activity. Maybe put in some prints before and after the require and before and after the init, as well as in the transactionListener function to get a better idea of the flow.

Are these devices in your control? If they are not, maybe they are rooted and someone has messed around with the store app. Maybe they are devices that don’t have Google Play installed.

Rob

Thanks Rob.

The devices are not in my control.  I uploaded the app into an internal release on the Google Play store. They generated a pre-launch report. I assume they run it on simulated virtual devices. It passed on Galaxy 9, Pixel 2 & 3 but failed on Galaxy 3 and LG K3.

In the report, it shows the video and I can see it randomly clicking. The app crashes as soon as they click on the button that goes to the IAP scene.

The logcat file also has the following:

The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

So it probably is an emulator issue.

You’d think that Google would have the right emulator images  :rolleyes:

I’m not aware of any timing delays, but we have some plugins that do asynchronous work in the “require” step. You could drop it in a 1 second timer to give it time. However, that looks like it couldn’t find the plugin or it couldn’t create the activity. Maybe put in some prints before and after the require and before and after the init, as well as in the transactionListener function to get a better idea of the flow.

Are these devices in your control? If they are not, maybe they are rooted and someone has messed around with the store app. Maybe they are devices that don’t have Google Play installed.

Rob

Thanks Rob.

The devices are not in my control.  I uploaded the app into an internal release on the Google Play store. They generated a pre-launch report. I assume they run it on simulated virtual devices. It passed on Galaxy 9, Pixel 2 & 3 but failed on Galaxy 3 and LG K3.

In the report, it shows the video and I can see it randomly clicking. The app crashes as soon as they click on the button that goes to the IAP scene.

The logcat file also has the following:

The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

So it probably is an emulator issue.

You’d think that Google would have the right emulator images  :rolleyes: