为什么在某些(不是全部)虚拟设备上启动模块活动时,我的应用程序崩溃?

时间:2019-02-04 17:42:42

标签: android module crash package launch

我的主应用启动正常。我单击启动一个提供消息传递功能的导入模块包,它始终在Galaxy Nexus(Android 7.0,API 24)模拟器上运行,而在Nexus 5X(Android 9,API 28)模拟器上始终运行失败。在后一种情况下,错误为:

  

android.content.ActivityNotFoundException:无法找到显式   活动课   {com.sendbird.android.sample / com.sendbird.android.sample.main.LoginActivity};   您是否在AndroidManifest.xml中声明了此活动?

该库通过以下代码调用:

        Intent startLoginActivity = new Intent();
        startLoginActivity.setClassName("com.sendbird.android.sample", "com.sendbird.android.sample.main.LoginActivity");
        startActivity(startLoginActivity);

导入的模块中的清单包含以下代码:

    <activity android:name=".main.LoginActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

在连接的设备Samsung SM-G930V(Android 8.0.0,API 26)上,导入的模块启动也失败。

当然,我希望它能在所有这些设备上运行。是什么原因导致某些设备崩溃,而不是其他设备?

(建议的解决方案here产生相同的错误。)

这是项目build.gradle:

buildscript {

    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是应用程序build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.church.george.vitalconcern"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 2
        versionName "1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'org.apache.commons:commons-text:1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.volley:volley:1.1.0'

}

这是Sendbird应用程序模块build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.sendbird.android.sample"
       minSdkVersion 16
        targetSdkVersion 28

        versionCode getVersionCode()
        versionName getVersionName()
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }

}


repositories {
    maven { url "https://raw.githubusercontent.com/smilefam/SendBird-SDK-Android/master/" }
    google()
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    // Required for local unit tests (JUnit 4 framework)
    testImplementation 'junit:junit:4.12'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    // SendBird
    implementation 'com.sendbird.sdk:sendbird-android-sdk:3.0.88'

    // Android support libraries
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'

    // Firebase
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'

    // External libraries
    implementation 'com.github.bumptech.glide:glide:4.3.1'
    implementation 'org.jsoup:jsoup:1.11.2'
    implementation 'com.dinuscxj:circleprogressbar:1.1.1'
    implementation 'com.github.stfalcon:multiimageview:0.1'
}
apply plugin: 'com.google.gms.google-services'

以下是主要应用清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="com.church.george.vitalconcern">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:name=".VitalConcern"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher_vc"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity android:name=".LognActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".MainActivity"
            android:theme="@style/AppTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
                <activity android:name=".EditListActivity"
            android:theme="@style/AppTheme" />
        <activity android:name="EditActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".LogoutActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".HelpListActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".HelpActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".AnnounceListActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".AnnounceActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".PostActivity"
            android:theme="@style/AppTheme"
            android:launchMode="singleTask"
            android:windowSoftInputMode="adjustPan"/>
        <activity android:name=".SettingsActivity"
            android:theme="@style/AppTheme"
            android:windowSoftInputMode="adjustPan" />
        <activity android:name=".FirstWelcomeActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".DetailsActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".PrayerActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".RequestListActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".PrayerListActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".NewEditActivity"
            android:theme="@style/AppTheme"
            android:launchMode="singleTask"
            android:windowSoftInputMode="adjustPan" />
        <activity android:name=".PasswordActivity"
            android:theme="@style/AppTheme"
            android:launchMode="singleTask"
            android:windowSoftInputMode="adjustPan" />
        <activity android:name=".PostConfirmActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".PrivacypolicyActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".TermsofuseActivity"
        android:theme="@style/AppTheme" />
        <activity android:name=".DemoWelcomeActivity"
            android:theme="@style/AppTheme"
            android:windowSoftInputMode="adjustPan"/>
        <activity android:name=".SignupActivity"
            android:theme="@style/AppTheme"
            android:windowSoftInputMode="adjustPan" />
        <activity android:name=".StartDemoActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".DemoPrivacyActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".DemoTermsActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".ThankyouActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".ForgotActivity"
        android:theme="@style/AppTheme" />
        <activity android:name=".SignupPrivacyActivity"
            android:theme="@style/AppTheme" />
        <activity android:name=".SignupTermsActivity"
            android:theme="@style/AppTheme" />

</application>

</manifest>

这是SendBird模块清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.sendbird.android.sample">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-sdk tools:overrideLibrary="com.stfalcon.multiimageview"/>

    <application
        android:name=".main.BaseApplication"
        android:allowBackup="true"
        android:icon="@mipmap/sendbird_ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".main.LoginActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".main.MainActivity"
            android:label="@string/select_channel_type"/>
        <activity
            android:name=".main.SettingsActivity"
            android:label="@string/settings" />
        <activity
            android:name=".main.BlockedMembersListActivity"
            android:label="@string/blocked_members_list" />

        <activity android:name=".utils.PhotoViewerActivity" />
        <activity
            android:name=".utils.MediaPlayerActivity"
            android:configChanges="orientation|screenSize" />
        <activity
            android:name=".openchannel.CreateOpenChannelActivity"
            android:label="@string/create_open_channel"
            android:windowSoftInputMode="stateVisible" />
        <activity
            android:name=".groupchannel.InviteMemberActivity"
            android:label="@string/invite_member" />
        <activity
            android:name=".groupchannel.MemberListActivity"
            android:label="@string/member_list" />
        <activity
            android:name=".groupchannel.MemberInfoActivity"
            android:label="@string/member_info" />
        <activity
            android:name=".groupchannel.CreateGroupChannelActivity"
            android:label="@string/create_group_channel" />
        <activity
            android:name=".openchannel.ParticipantListActivity"
            android:label="@string/participant_list" />
        <activity android:name=".openchannel.OpenChannelActivity"
            android:windowSoftInputMode="stateHidden" />
        <activity android:name=".groupchannel.GroupChannelActivity"
            android:windowSoftInputMode="stateHidden" />

        <service android:name=".fcm.MyFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
        <service android:name=".fcm.MyFirebaseInstanceIDService">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
            </intent-filter>
        </service>

    </application>

</manifest>

0 个答案:

没有答案