问题
I developed a hybrid mobile app integrating SalesForce Mobile SDK with Ionic using Brett Nelson's set of blog posts -
After following the set of instructions in this post - https://wipdeveloper.com/2017/06/27/saleforce-mobile-sdk-ionic-setup-mobile-sdk/ and setting up the org and running the app in Android Studio -> emulator, the app opened up alright.
After following these set of instructions - https://wipdeveloper.com/author/brettmn/page/6/
wherein I integrated (basically copy pasted) - package.json elements, resources etc. - from the CLI generated Ionic app to the SalesForce SDK project in Step 1, I cannot get to run the project in emulator.
While running, the LogCat emits the following information:
0-4310/com.wipdeveloper.contacts E/AndroidRuntime: FATAL EXCEPTION: main Process: com.wipdeveloper.contacts, PID: 4310 java.lang.RuntimeException: Unable to instantiate application com.salesforce.androidsdk.phonegap.app.HybridApp: java.lang.ClassNotFoundException: Didn't find class "com.salesforce.androidsdk.phonegap.app.HybridApp" on path: DexPathList[[zip file "/data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/base.apk", zip file "/data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/split_lib_dependencies_apk.apk", zip file "/data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/split_lib_slice_0_apk.apk", zip file "/data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/split_lib_slice_1_apk.apk", zip file "/data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/split_lib_slice_2_apk.apk", zip file "/data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/split_lib_slice_3_apk.apk", zip file "/data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/split_lib_slice_4_apk.apk", zip file "/data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/split_lib_slice_5_apk.apk", zip file "/data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/split_lib_slice_6_apk.apk", zip file "/data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/split_lib_slice_7_apk.apk", zip file "/data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/split_lib_slice_8_apk.apk", zip file "/data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/lib/x86, /system/lib, /vendor/lib]] at android.app.LoadedApk.makeApplication(LoadedApk.java:989) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5715) at android.app.ActivityThread.-wrap1(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) at android.os.Handler.dispatchMessage(Handler.java:106)
The manifest file looks like this ->
The project structure is as below ->
What is the configuration that is missing? Or incorrect?
Note: This question here seems to have a similar problem, but no resolution: Unable to instantiate application com.salesforce.androidsdk.phonegap.app.HybridApp: java.lang.ClassNotFoundException:
回答1:
After step 2 in your question, you may have to remove and then re-add the platform you are targeting.
For iOS
ionic cordova platform remove ios
ionic cordova platform add ios@4.4.0
Or for Android
ionic cordova platform remove android
ionic cordova platform add android@6.2.3
If you do that and still have problems try removing and re-adding the salesforce mobile sdk.
cordova plugin remove com.salesforce
cordova plugin add https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin --force
来源:https://stackoverflow.com/questions/47321706/exception-java-lang-runtimeexception-unable-to-instantiate-application-com-sal