romk1n/MyCordovaShop

Not Work on Android

Closed this issue · 13 comments

Hi ,

IOS it ok but android is not working

Thanks

@kentmt what doesn't work?

I'm click Buy Now button but it doesn't work

@kentmt what error messages do you see in the logcat ?

Same here, can't make it work on android. I'm using the chrome inspector and the last event I see is 'Received Event: deviceready'.

@maldewar can you be more specific of what is not working, what do you see on screen what you try to do. logcat output. thanks.

Yes, looks like the onCompleteCallback for the PayPalMobile.init function is not being called due to these errors...

D/CordovaWebView(11448): CordovaWebView is running on device made by: samsung
D/CordovaActivity(11448): CordovaActivity.createViews()
D/CordovaWebView(11448): >>> loadUrl(file:///android_asset/www/index.html)
D/CordovaWebView(11448): >>> loadUrlNow()
D/CordovaActivity(11448): Resuming the App
D/CordovaWebViewClient(11448): onPageStarted(file:///android_asset/www/index.html)
D/CordovaActivity(11448): onMessage(onPageStarted,file:///android_asset/www/index.html)
D/CordovaLog(11448): file:///android_asset/www/index.html: Line 26 : Viewport target-densitydpi is not supported.
D/CordovaWebViewClient(11448): onPageFinished(file:///android_asset/www/index.html)
D/CordovaActivity(11448): onMessage(onPageFinished,file:///android_asset/www/index.html)
D/CordovaActivity(11448): onMessage(spinner,stop)
D/CordovaLog(11448): file:///android_asset/www/js/index.js: Line 47 : Received Event: deviceready
I/AMMetaDataParserService(28553): Resource data:Loop for running activitycom.mycompany.cordova.myshop.CordovaApp
D/CordovaActivity(11448): onMessage(spinner,stop)
W/System.err(11448): java.lang.ClassNotFoundException: com.paypal.cordova.sdk.PayPalMobileCordovaPlugin
W/System.err(11448):    at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
W/System.err(11448): Caused by: java.lang.NoClassDefFoundError: com/paypal/cordova/sdk/PayPalMobileCordovaPlugin
W/System.err(11448): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.paypal.cordova.sdk.PayPalMobileCordovaPlugin" on path: DexPathList[[zip file "/data/app/com.mycompany.cordova.myshop-9.apk"],nativeLibraryDirectories=[/data/app-lib/com.mycompany.cordova.myshop-9, /vendor/lib, /system/lib]]
I/System.out(11448): Error adding plugin com.paypal.cordova.sdk.PayPalMobileCordovaPlugin.
W/System.err(11448):    at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)

@maldewar i just checkout on the example and it run with no issues on android 5.0.2 Nexus 7 device.

From the log it seems that the plugin hasn't been loaded so i wonder if you have a problem with the setup. can you check that PayPalMobileCordovaPlugin.java exists under MyCordovaShop/platforms/android/src/com/paypal/cordova/sdk and also PayPalAndroidSDK-2.8.3.jar and other *.so files in armeabi-v7a x86 armeabi mips directory are present under MyCordovaShop/platforms/android/libs ?

I am also using cordova 4.2.0, what version of android tools and APIs are you using ?

No PayPalMobileCordovaPlugin.java and no jar.
I had to remove the original android folder that came with the repo (cordova couldn't build the project because the JAVA_HOME wasn't properly set).
Then I added the android platform again.

cordova platform add android

then run the rm/add plugin

cordova plugin rm com.paypal.cordova.mobilesdk
cordova plugin add com.paypal.cordova.mobilesdk

The command reporter the plugin was installed, but no jar nor PayPalMobileCordovaPlugin.java files were created at the referenced paths.

I'm using cordova 4.2.0 too, deploying to a galaxy s5 with android 4.4.2, Android SDK Build-tools 17

@maldewar hmm can you also try to remove both platform and plugin first like this

$cordova platform remove android
$cordova plugin rm com.paypal.cordova.mobilesdk
$cordova plugin add com.paypal.cordova.mobilesdk
$cordova plugin add android
$ls -R platforms/android/libs

you should see a jar file and bunch of .so files

additionally also double check that ls -R platforms/android/src/com/paypal shows java file. Thanks.

It works now!
The steps above did include all the required files. Additionally, when building the project this time the build tool complained about being too old and requiring at least v19.0.2. I updated the android build tools and now it runs smoothly :D

Thanks romk1n!

@maldewar fantastic! glad we figured it out!

Hello.

I faced the same problem.. I am using phonegap though.
I followed the above batch of commands.. but for the last one i encountered an error:
Cannot find plugin.xml for plugin "android".

Any ideas?