异常:java.lang.RuntimeException:无法实例化应用程序com.salesforce.androidsdk.phonegap.app.HybridApp

时间:2017-11-16 04:36:11

标签: android cordova android-studio ionic-framework salesforce-ios-sdk

我开发了一个混合移动应用程序,使用Brett Nelson的一组博客文章将SalesForce Mobile SDK与Ionic集成 -

  1. 按照本帖子中的说明进行操作后 - https://wipdeveloper.com/2017/06/27/saleforce-mobile-sdk-ionic-setup-mobile-sdk/ 并在Android Studio中设置组织并运行应用程序 - >模拟器,应用程序打开正常。

  2. 遵循这些说明后 - https://wipdeveloper.com/author/brettmn/page/6/

  3. 其中我集成了(基本上是复制粘贴) - package.json元素,资源等 - 从CLI生成的Ionic app到第1步的SalesForce SDK项目,我无法在模拟器中运行项目。

    运行时,LogCat会发出以下信息:

    0-4310 / com.wipdeveloper.contacts E / AndroidRuntime:FATAL EXCEPTION:main                                                                          处理:com.wipdeveloper.contacts,PID:4310                                                                          java.lang.RuntimeException:无法实例化应用程序com.salesforce.androidsdk.phonegap.app.HybridApp:java.lang.ClassNotFoundException:未找到类" com.salesforce.androidsdk.phonegap.app.HybridApp& #34;在路径上:DexPathList [[zip文件" /data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA == / base.apk",zip文件" /data/app/com.wipdeveloper.contacts -gVdyqj5Na6koBXGU6VuxfA == / split_lib_dependencies_apk.apk",zip文件" /data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA == / split_lib_slice_0_apk.apk",zip文件" / data / app /com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA==/split_lib_slice_1_apk.apk" ;, zip文件" /data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA == / split_lib_slice_2_apk.apk",zip文件&# 34; /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&#34 ;,zip文件" /data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA == / split_lib_slice_5_apk.apk",zip文件" /data/app/com.wipdeveloper.contacts-gVdyqj5Na6koBXGU6VuxfA== /split_lib_slice_6_apk.apk" ;, zip文件" / 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, /供应商/ LIB]]                                                                              在android.app.LoadedApk.makeApplication(LoadedApk.java:989)                                                                              在android.app.ActivityThread.handleBindApplication(ActivityThread.java:5715)                                                                              在android.app.ActivityThread.-wrap1(未知来源:0)                                                                              在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1656)                                                                              在android.os.Handler.dispatchMessage(Handler.java:106)

    清单文件如下所示 - > enter image description here

    项目结构如下 - >

    enter image description here

    缺少什么配置?还是不正确?

    注意:这里的问题似乎有类似的问题,但没有解决方案: Unable to instantiate application com.salesforce.androidsdk.phonegap.app.HybridApp: java.lang.ClassNotFoundException:

1 个答案:

答案 0 :(得分:2)

在问题的第2步之后,您可能需要删除然后重新添加您要定位的平台。

适用于iOS

class SuperCoolButton: DarkButton {

    required init() {
        super.init()
        //self.setUp()
    }

    required init(spacing: Spacing) {
        super.init(spacing: spacing)
        //self.setUp()
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        //self.setUp()
    }

    func setUp() {
        self.generateImage()
        self.changeBGColor()
    }

    func generateImage() {
        let image = UIImage(named: "logoSmall") as UIImage?
        self.setImage(image, for: .normal)
        self.imageEdgeInsets = UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0)
        self.imageView?.contentMode = .scaleAspectFit
    }

    func changeBGColor() {
        self.layer.backgroundColor = UIColor.red.cgColor
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        setUp()
    }
}

或Android版

ionic cordova platform remove ios
ionic cordova platform add ios@4.4.0

如果您这样做但仍有问题请尝试删除并重新添加salesforce mobile sdk。

ionic cordova platform remove android
ionic cordova platform add android@6.2.3