Plugin Not Working

Hi guys,

Using ‘Corona Enterprise 2016.2970’

I am trying to put the put the qr-scanner plugin in my Android-enterprise project. Nothing seems to appear (no error in android-studio). The qr-scanner plugin works fine in SDK (i have not purchased the qr-scanner plugin yet). 

I have copied the ‘.jar’ files from https://bitbucket.org/coronalabs and placed them in my ‘libs’ folder.

Is there something that needs to be done since the plugin is now a paid-plugin ?

Thanks

local g\_vibrator = require('plugin.vibrator') local g\_qrscanner = require('plugin.qrscanner') g\_vibrator.vibrate( { 100, 200, 200, 500 } ) local function startQRScanner() local function listener(message) -- message variable contains the value of a scanned QR Code. native.showAlert('QR Code Scanner', message, {'OK'}) end g\_qrscanner.show(listener) print( 'Done showing QR' ) end timer.performWithDelay( 5000, startQRScanner )

My 'build.gradle (app) :

dependencies { compile fileTree(dir: "$coronaEnterpriseAndroidLibDir/libs", include: '\*.jar') compile fileTree(dir: 'libs', include: 'libs/zbar.jar') compile fileTree(dir: 'libs', include: '\*.jar') compile 'com.android.support:appcompat-v7:23.4.0' compile project(':facebook') }

What is “libs/zbar.jar”? Why is it separate?

I think it was part of some old code. I removed it. Same issue. Here’s the logcat.

On Android 4.3, the screen shows the camera view , but not the top-bar

On Android 6, same screen as Android 4.3. And sometimes (when I clean->run the app, it is a blank-screen)

Notice this error, which seems to be related to the FrameLayout :

ViewRootImpl #2 Surface is not valid.

Full Adb logcat :

Android 4.3 10-16 18:42:50.610 22703-22727/com.xxx V/Corona: Loading via reflection: plugin.qrscanner.LuaLoader 10-16 18:42:50.615 22703-22727/com.xxx V/Vibrator: Called vibrate(long[], int) API - PUID: 10164, PackageName: com.xxx 10-16 18:42:50.615 22703-22727/com.xxx V/Vibrator: vibrate - PUID: 10164, PackageName: com.xxx, pattern, repeat: -1 10-16 18:42:50.615 22703-22727/com.xxx I/Corona: [Lua::RuntimeDispatchEvent()] WARNING: This function is deprecated. Use Lua::DispatchRuntimeEvent() instead. 10-16 18:42:55.625 22703-22727/com.xxx I/Corona: showing qr 10-16 18:42:55.635 22703-22727/com.xxx I/Corona: Done showing QR 10-16 18:42:55.925 22703-22703/com.xxx D/SensorManager: unregisterListener :: 10-16 18:42:56.230 22703-22703/com.xxx E/ViewSystem: ViewRootImpl #2 Surface is not valid. 10-16 18:42:56.240 22703-22703/com.xxx W/dalvikvm: VFY: unable to resolve static field 13459 (qrscanner) in Lplugin/qrscanner/R$menu; 10-16 18:42:56.240 22703-22703/com.xxx D/dalvikvm: VFY: replacing opcode 0x60 at 0x0004 10-16 18:42:56.240 22703-22703/com.xxx W/dalvikvm: VFY: unable to resolve static field 13458 (action\_flash) in Lplugin/qrscanner/R$id; 10-16 18:42:56.240 22703-22703/com.xxx D/dalvikvm: VFY: replacing opcode 0x60 at 0x0017 10-16 18:42:56.240 22703-22703/com.xxx W/dalvikvm: VFY: unable to resolve static field 13458 (action\_flash) in Lplugin/qrscanner/R$id; 10-16 18:42:56.240 22703-22703/com.xxx D/dalvikvm: VFY: replacing opcode 0x60 at 0x0000 10-16 18:42:56.245 22703-22703/com.xxx I/dalvikvm: DexOpt: unable to optimize static field ref 0x3491 at 0x3a in Lplugin/qrscanner/CameraActivity;.onOptionsItemSelected 10-16 18:42:56.245 22703-22703/com.xxx I/dalvikvm: DexOpt: unable to optimize static field ref 0x3490 at 0x4a in Lplugin/qrscanner/CameraActivity;.onOptionsItemSelected 10-16 18:42:56.245 22703-22703/com.xxx D/dalvikvm: Trying to load lib /data/app-lib/com.xxx-2/libiconv.so 0x4281be30 10-16 18:42:56.255 22703-22703/com.xxx D/dalvikvm: Added shared lib /data/app-lib/com.xxx-2/libiconv.so 0x4281be30 10-16 18:42:56.255 22703-22703/com.xxx D/dalvikvm: No JNI\_OnLoad found in /data/app-lib/com.xxx-2/libiconv.so 0x4281be30, skipping init 10-16 18:42:56.415 22703-22703/com.xxx D/dalvikvm: Trying to load lib /data/app-lib/com.xxx-2/libzbarjni.so 0x4281be30 10-16 18:42:56.420 22703-22703/com.xxx D/dalvikvm: Added shared lib /data/app-lib/com.xxx-2/libzbarjni.so 0x4281be30 10-16 18:42:57.135 22703-22703/com.xxx I/Choreographer: Skipped 53 frames! The application may be doing too much work on its main thread. 10-16 18:42:57.770 22703-22703/com.xxx D/dalvikvm: GC\_FOR\_ALLOC freed 3638K, 33% free 10070K/14860K, paused 13ms, total 13ms 10-16 18:42:58.200 22703-22703/com.xxx I/Choreographer: Skipped 62 frames! The application may be doing too much work on its main thread. 10-16 18:42:58.420 22703-22703/com.xxx E/ViewRootImpl: sendUserActionEvent() mView == null 10-16 18:42:58.420 22703-22703/com.xxx E/ViewRootImpl: sendUserActionEvent() mView == null Android 6.0.1 10-16 18:46:44.509 10194-10261/com.xxx V/Corona: Loading via reflection: plugin.qrscanner.LuaLoader 10-16 18:46:44.509 10194-10261/com.xxx V/Vibrator: Called vibrate(long[], int) API! 10-16 18:46:44.509 10194-10261/com.xxx V/Vibrator: vibrate(long[], int, AudioAttributes) API - PUID: 10356, PackageName: com.xxx, repeat: -1, AudioAttr: null 10-16 18:46:44.509 10194-10261/com.xxx V/Vibrator: Called vibrate(int, String, long[], int, AudioAttributes) API - PUID: 10356, PackageName: com.xxx, pattern 10-16 18:46:44.509 10194-10261/com.xxx V/Vibrator: vibrate - PUID: 10356, PackageName: com.xxx, pattern, repeat: -1, AudioAttr: null, mag: -1 10-16 18:46:44.509 10194-10261/com.xxx I/Corona: [Lua::RuntimeDispatchEvent()] WARNING: This function is deprecated. Use Lua::DispatchRuntimeEvent() instead. 10-16 18:46:49.509 10194-10261/com.xxx I/Corona: showing qr 10-16 18:46:49.519 10194-10261/com.xxx I/Corona: Done showing QR 10-16 18:49:36.529 10194-10194/com.xxx D/SensorManager: unregisterListener :: 

.

Please try now using the latest daily build (2972+).

I just tried with build 2972

Having the same results. Could it be my xml-layout interfering ?

Logcat :

10-17 16:39:52.749 3409-3481/com.xxx V/Corona: \> Class.forName: plugin.vibrator.LuaLoader 10-17 16:39:52.749 3409-3481/com.xxx V/Corona: \< Class.forName: plugin.vibrator.LuaLoader 10-17 16:39:52.749 3409-3481/com.xxx V/Corona: Loading via reflection: plugin.vibrator.LuaLoader 10-17 16:39:52.749 3409-3481/com.xxx V/Corona: \> Class.forName: plugin.qrscanner.LuaLoader 10-17 16:39:52.749 3409-3481/com.xxx V/Corona: \< Class.forName: plugin.qrscanner.LuaLoader 10-17 16:39:52.749 3409-3481/com.xxx V/Corona: Loading via reflection: plugin.qrscanner.LuaLoader 10-17 16:39:52.759 3409-3481/com.xxx V/Vibrator: Called vibrate(long[], int) API! 10-17 16:39:52.759 3409-3481/com.xxx V/Vibrator: vibrate(long[], int, AudioAttributes) API - PUID: 10356, PackageName: com.xxx, repeat: -1, AudioAttr: null 10-17 16:39:52.759 3409-3481/com.xxx V/Vibrator: Called vibrate(int, String, long[], int, AudioAttributes) API - PUID: 10356, PackageName: com.xxx, pattern 10-17 16:39:52.759 3409-3481/com.xxx V/Vibrator: vibrate - PUID: 10356, PackageName: com.xxx, pattern, repeat: -1, AudioAttr: null, mag: -1 10-17 16:39:52.769 3409-3481/com.xxx I/Corona: [Lua::RuntimeDispatchEvent()] WARNING: This function is deprecated. Use Lua::DispatchRuntimeEvent() instead. 10-17 16:39:57.779 3409-3481/com.xxx I/Corona: showing qr 10-17 16:39:57.779 3409-3481/com.xxx I/Corona: Done showing QR 10-17 16:39:57.789 3409-3409/com.xxx I/Timeline: Timeline: Activity\_launch\_request id:com.xxx time:338127335 10-17 16:39:57.809 3409-3409/com.xxx D/SensorManager: unregisterListener :: 10-17 16:39:57.969 3409-3409/com.xxx E/ViewSystem: ViewRootImpl #2 Surface is not valid. 10-17 16:39:57.969 3409-3409/com.xxx D/ViewRootImpl: MSG\_RESIZED\_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=2 10-17 16:39:57.979 3409-3409/com.xxx W/ResourcesManager: getTopLevelResources: /data/app/com.xxx-2/base.apk / 1.0 running in com.xxx rsrc of package com.xxx 10-17 16:39:58.039 3409-3409/com.xxx D/Activity: performCreate Call Injection manager 10-17 16:39:58.039 3409-3409/com.xxx I/InjectionManager: dispatchOnViewCreated \> Target : plugin.qrscanner.CameraActivity isFragment :false 10-17 16:39:58.109 3409-3409/com.xxx D/SecWifiDisplayUtil: Metadata value : SecSettings2 10-17 16:39:58.109 3409-3409/com.xxx D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{d18eb4a I.E...... R.....ID 0,0-0,0} 10-17 16:39:58.129 3409-3500/com.xxx D/mali\_winsys: new\_window\_surface returns 0x3000, [1440x2560]-format:1 10-17 16:39:58.709 3409-3409/com.xxx D/ViewRootImpl: #3 mView = null

.

Forgot that you were using Corona Enterprise.
Where did you put plugin’s resources?

I put them in :

android -> app -> libs

That’s where all the other .jar files are. 

compile fileTree(dir: 'libs', include: '\*.jar')

yosu, ok, so you are not including the resources. The plugin won’t work without them.
They are located in the resources directory in bitbucket repo.
If you simply copy resources to your app, it won’t work because package name would be different.

So to ease up the installation procedure I’ve uploaded an AAR file to the repo. Look inside android_enterprise directory.
This file contains all the needed libs plus resources. Try using it.

The code/source to download, is missing from the bitbucket. Could you please help to check.

Thanks

Go to https://bitbucket.org/coronalabs
And navigate to
store-hosted-qrscanner / plugins / 2016.2972 / android_enterprise /

There you can find plugin-qrscanner.aar

I am not saying i don’t know where the qr plugin is.

Instead of navigating, it is much faster to just search ‘qr’ in bitbucket search-box.

The qr plugin is no longer available in the bitBucket. I think someone in Corona removed the permission or something.

Can someone in charge of it in Corona check it out

Thx

yosu, oh, ok.

Thanks Lerg. Will test it out.

What is “libs/zbar.jar”? Why is it separate?

I think it was part of some old code. I removed it. Same issue. Here’s the logcat.

On Android 4.3, the screen shows the camera view , but not the top-bar

On Android 6, same screen as Android 4.3. And sometimes (when I clean->run the app, it is a blank-screen)

Notice this error, which seems to be related to the FrameLayout :

ViewRootImpl #2 Surface is not valid.

Full Adb logcat :

Android 4.3 10-16 18:42:50.610 22703-22727/com.xxx V/Corona: Loading via reflection: plugin.qrscanner.LuaLoader 10-16 18:42:50.615 22703-22727/com.xxx V/Vibrator: Called vibrate(long[], int) API - PUID: 10164, PackageName: com.xxx 10-16 18:42:50.615 22703-22727/com.xxx V/Vibrator: vibrate - PUID: 10164, PackageName: com.xxx, pattern, repeat: -1 10-16 18:42:50.615 22703-22727/com.xxx I/Corona: [Lua::RuntimeDispatchEvent()] WARNING: This function is deprecated. Use Lua::DispatchRuntimeEvent() instead. 10-16 18:42:55.625 22703-22727/com.xxx I/Corona: showing qr 10-16 18:42:55.635 22703-22727/com.xxx I/Corona: Done showing QR 10-16 18:42:55.925 22703-22703/com.xxx D/SensorManager: unregisterListener :: 10-16 18:42:56.230 22703-22703/com.xxx E/ViewSystem: ViewRootImpl #2 Surface is not valid. 10-16 18:42:56.240 22703-22703/com.xxx W/dalvikvm: VFY: unable to resolve static field 13459 (qrscanner) in Lplugin/qrscanner/R$menu; 10-16 18:42:56.240 22703-22703/com.xxx D/dalvikvm: VFY: replacing opcode 0x60 at 0x0004 10-16 18:42:56.240 22703-22703/com.xxx W/dalvikvm: VFY: unable to resolve static field 13458 (action\_flash) in Lplugin/qrscanner/R$id; 10-16 18:42:56.240 22703-22703/com.xxx D/dalvikvm: VFY: replacing opcode 0x60 at 0x0017 10-16 18:42:56.240 22703-22703/com.xxx W/dalvikvm: VFY: unable to resolve static field 13458 (action\_flash) in Lplugin/qrscanner/R$id; 10-16 18:42:56.240 22703-22703/com.xxx D/dalvikvm: VFY: replacing opcode 0x60 at 0x0000 10-16 18:42:56.245 22703-22703/com.xxx I/dalvikvm: DexOpt: unable to optimize static field ref 0x3491 at 0x3a in Lplugin/qrscanner/CameraActivity;.onOptionsItemSelected 10-16 18:42:56.245 22703-22703/com.xxx I/dalvikvm: DexOpt: unable to optimize static field ref 0x3490 at 0x4a in Lplugin/qrscanner/CameraActivity;.onOptionsItemSelected 10-16 18:42:56.245 22703-22703/com.xxx D/dalvikvm: Trying to load lib /data/app-lib/com.xxx-2/libiconv.so 0x4281be30 10-16 18:42:56.255 22703-22703/com.xxx D/dalvikvm: Added shared lib /data/app-lib/com.xxx-2/libiconv.so 0x4281be30 10-16 18:42:56.255 22703-22703/com.xxx D/dalvikvm: No JNI\_OnLoad found in /data/app-lib/com.xxx-2/libiconv.so 0x4281be30, skipping init 10-16 18:42:56.415 22703-22703/com.xxx D/dalvikvm: Trying to load lib /data/app-lib/com.xxx-2/libzbarjni.so 0x4281be30 10-16 18:42:56.420 22703-22703/com.xxx D/dalvikvm: Added shared lib /data/app-lib/com.xxx-2/libzbarjni.so 0x4281be30 10-16 18:42:57.135 22703-22703/com.xxx I/Choreographer: Skipped 53 frames! The application may be doing too much work on its main thread. 10-16 18:42:57.770 22703-22703/com.xxx D/dalvikvm: GC\_FOR\_ALLOC freed 3638K, 33% free 10070K/14860K, paused 13ms, total 13ms 10-16 18:42:58.200 22703-22703/com.xxx I/Choreographer: Skipped 62 frames! The application may be doing too much work on its main thread. 10-16 18:42:58.420 22703-22703/com.xxx E/ViewRootImpl: sendUserActionEvent() mView == null 10-16 18:42:58.420 22703-22703/com.xxx E/ViewRootImpl: sendUserActionEvent() mView == null Android 6.0.1 10-16 18:46:44.509 10194-10261/com.xxx V/Corona: Loading via reflection: plugin.qrscanner.LuaLoader 10-16 18:46:44.509 10194-10261/com.xxx V/Vibrator: Called vibrate(long[], int) API! 10-16 18:46:44.509 10194-10261/com.xxx V/Vibrator: vibrate(long[], int, AudioAttributes) API - PUID: 10356, PackageName: com.xxx, repeat: -1, AudioAttr: null 10-16 18:46:44.509 10194-10261/com.xxx V/Vibrator: Called vibrate(int, String, long[], int, AudioAttributes) API - PUID: 10356, PackageName: com.xxx, pattern 10-16 18:46:44.509 10194-10261/com.xxx V/Vibrator: vibrate - PUID: 10356, PackageName: com.xxx, pattern, repeat: -1, AudioAttr: null, mag: -1 10-16 18:46:44.509 10194-10261/com.xxx I/Corona: [Lua::RuntimeDispatchEvent()] WARNING: This function is deprecated. Use Lua::DispatchRuntimeEvent() instead. 10-16 18:46:49.509 10194-10261/com.xxx I/Corona: showing qr 10-16 18:46:49.519 10194-10261/com.xxx I/Corona: Done showing QR 10-16 18:49:36.529 10194-10194/com.xxx D/SensorManager: unregisterListener :: 

.

Please try now using the latest daily build (2972+).

I just tried with build 2972

Having the same results. Could it be my xml-layout interfering ?

Logcat :

10-17 16:39:52.749 3409-3481/com.xxx V/Corona: \> Class.forName: plugin.vibrator.LuaLoader 10-17 16:39:52.749 3409-3481/com.xxx V/Corona: \< Class.forName: plugin.vibrator.LuaLoader 10-17 16:39:52.749 3409-3481/com.xxx V/Corona: Loading via reflection: plugin.vibrator.LuaLoader 10-17 16:39:52.749 3409-3481/com.xxx V/Corona: \> Class.forName: plugin.qrscanner.LuaLoader 10-17 16:39:52.749 3409-3481/com.xxx V/Corona: \< Class.forName: plugin.qrscanner.LuaLoader 10-17 16:39:52.749 3409-3481/com.xxx V/Corona: Loading via reflection: plugin.qrscanner.LuaLoader 10-17 16:39:52.759 3409-3481/com.xxx V/Vibrator: Called vibrate(long[], int) API! 10-17 16:39:52.759 3409-3481/com.xxx V/Vibrator: vibrate(long[], int, AudioAttributes) API - PUID: 10356, PackageName: com.xxx, repeat: -1, AudioAttr: null 10-17 16:39:52.759 3409-3481/com.xxx V/Vibrator: Called vibrate(int, String, long[], int, AudioAttributes) API - PUID: 10356, PackageName: com.xxx, pattern 10-17 16:39:52.759 3409-3481/com.xxx V/Vibrator: vibrate - PUID: 10356, PackageName: com.xxx, pattern, repeat: -1, AudioAttr: null, mag: -1 10-17 16:39:52.769 3409-3481/com.xxx I/Corona: [Lua::RuntimeDispatchEvent()] WARNING: This function is deprecated. Use Lua::DispatchRuntimeEvent() instead. 10-17 16:39:57.779 3409-3481/com.xxx I/Corona: showing qr 10-17 16:39:57.779 3409-3481/com.xxx I/Corona: Done showing QR 10-17 16:39:57.789 3409-3409/com.xxx I/Timeline: Timeline: Activity\_launch\_request id:com.xxx time:338127335 10-17 16:39:57.809 3409-3409/com.xxx D/SensorManager: unregisterListener :: 10-17 16:39:57.969 3409-3409/com.xxx E/ViewSystem: ViewRootImpl #2 Surface is not valid. 10-17 16:39:57.969 3409-3409/com.xxx D/ViewRootImpl: MSG\_RESIZED\_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=2 10-17 16:39:57.979 3409-3409/com.xxx W/ResourcesManager: getTopLevelResources: /data/app/com.xxx-2/base.apk / 1.0 running in com.xxx rsrc of package com.xxx 10-17 16:39:58.039 3409-3409/com.xxx D/Activity: performCreate Call Injection manager 10-17 16:39:58.039 3409-3409/com.xxx I/InjectionManager: dispatchOnViewCreated \> Target : plugin.qrscanner.CameraActivity isFragment :false 10-17 16:39:58.109 3409-3409/com.xxx D/SecWifiDisplayUtil: Metadata value : SecSettings2 10-17 16:39:58.109 3409-3409/com.xxx D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{d18eb4a I.E...... R.....ID 0,0-0,0} 10-17 16:39:58.129 3409-3500/com.xxx D/mali\_winsys: new\_window\_surface returns 0x3000, [1440x2560]-format:1 10-17 16:39:58.709 3409-3409/com.xxx D/ViewRootImpl: #3 mView = null

.

Forgot that you were using Corona Enterprise.
Where did you put plugin’s resources?

I put them in :

android -> app -> libs

That’s where all the other .jar files are. 

compile fileTree(dir: 'libs', include: '\*.jar')

yosu, ok, so you are not including the resources. The plugin won’t work without them.
They are located in the resources directory in bitbucket repo.
If you simply copy resources to your app, it won’t work because package name would be different.

So to ease up the installation procedure I’ve uploaded an AAR file to the repo. Look inside android_enterprise directory.
This file contains all the needed libs plus resources. Try using it.