Exception: java.lang.RuntimeException: Unable to instantiate application com.salesforce.androidsdk.phonegap.app.HybridApp

爷,独闯天下 提交于 2019-12-11 08:24:15

问题


I developed a hybrid mobile app integrating SalesForce Mobile SDK with Ionic using Brett Nelson's set of blog posts -

  1. 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.

  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!