Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin not working #157

Closed
coderReview opened this issue Feb 6, 2016 · 22 comments
Closed

Plugin not working #157

coderReview opened this issue Feb 6, 2016 · 22 comments

Comments

@coderReview
Copy link
Contributor

Create a project using the steps in readme.
Running using:

cordova run --debug android

I get the exception:

java.lang.ClassNotFoundException: com.salesforce.androidsdk.phonegap.plugin.SalesforceOAuthPlugin

@toddhalfpenny
Copy link
Contributor

I have found that I need to, following cordova prepare that I need to open in Android Studio to build and run the project. Using the cordova commands at this stage causes me issues.

@coderReview
Copy link
Contributor Author

In android studio I get a lot of errors:
Error:(5, 0) Project with path ':libs:SmartSync' could not be found in project ':SalesforceHybrid'.

@toddhalfpenny
Copy link
Contributor

Ah right, there is a post install script that should run after the SF plugin us added. This requires shelljs npm package to be installed locally. Could be that this is not there?

@coderReview
Copy link
Contributor Author

It is there. What cordova version is to be used? Can it be the latest one?

@wmathurin
Copy link
Contributor

Could you run:

npm list -g | grep -A1 forcedroid

To see what version of forcedroid and dependent packages you are using.

shelljs released a new version (0.6.0) on thursday which causes forcedroid to not copy files the right way when setting up an hybrid applications. We should have a patch release out soon.

@coderReview
Copy link
Contributor Author

What version of shelljs is compatible with forcedroid?

@wmathurin
Copy link
Contributor

wmathurin commented Feb 6, 2016 via email

@coderReview
Copy link
Contributor Author

Using 0.5.3 work partially. I had to manually run the script to update the AndroidManifest.xml:

shjs plugins/com.salesforce/tools/postinstall-android.js

@coderReview
Copy link
Contributor Author

After that when building the code using

cordova build android

I get the following error:

platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml:35:23-41 : No resource found that matches the given name (at 'icon' with value '@drawable/sf__icon').

@coderReview
Copy link
Contributor Author

Only worked if I open the project in Android Studio

@toddhalfpenny
Copy link
Contributor

Yup, same here (though I had the same with earlier version of shelljs).

@coderReview
Copy link
Contributor Author

Now I am getting error in dexDebug because of the android method limit. Caused by the play services library.

@toddhalfpenny
Copy link
Contributor

Cool, you can overcome this by replacing the following line in build-gradle with this;

compile "com.google.android.gms:play-services:7.5.0"

with

compile "com.google.android.gms:play-services-gcm:7.5.0"

This reduces the Google services to be pulled in.

I have some notes on my progress and issues so far, but not thoroughly tested yet.

@coderReview
Copy link
Contributor Author

Thanks. Got it to compile. Now I manage to login to Salesforce, but got a new error:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/xxx/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libstlport_shared.so"

@toddhalfpenny
Copy link
Contributor

Good stuff, I have seen that too... But can't remember how I git round it. Sorry not at my pc till Monday (it's Sat night where I am), but I can post up then if you don't get past this by then.

Might be worth searching the issues on this repo for any errors as I did initially post a few of my notes up.

@coderReview
Copy link
Contributor Author

Found it in previous issue. Finally managed to get the application working. I will do a merge request for the play service and libstlport_shared.so issue.

Still don't understand why the AndroidManifest.xml file didn't get updated when the plugin is added only after running shjs manually.

@toddhalfpenny
Copy link
Contributor

Fantastic!
You don't happen to have other plugins installed do you?

@coderReview
Copy link
Contributor Author

Lots of other plugins, :).

cordova-plugin-console
cordova-plugin-datepicker
cordova-plugin-device
cordova-plugin-network-information
cordova-plugin-splashscreen
cordova-plugin-statusbar
cordova-plugin-whitelist
cordova-plugin-x-toast
ionic-plugin-keyboard
phonegap-plugin-push

@toddhalfpenny
Copy link
Contributor

Ah right, so I have a theory that the SF plugin currently needs to be the last to be added, otherwise things don't quite go to plan.
You could try removing the sf plugin, removing and adding the platform and then re-adding the SF plugin.
Like I said I have some notes but nothing to concrete yet.

@coderReview
Copy link
Contributor Author

There is a fetch.json file. The Salesforce plugin is the last one in the file.

@coderReview
Copy link
Contributor Author

What I did.

cordova platform rm android
cordova plugin rm com.salesforce
cordova platform add android@5.0.0
cordova plugin add https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin.git

AndroidManifest.xml wasn't updated by the post installation script.

@bhariharan
Copy link
Contributor

This issue should be resolved in our 4.1 release, which is now live.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants