如何在android 4.4和7中运行应用程序?

时间:2019-01-29 10:15:05

标签: android

如何在android 4.4和7中运行应用程序?

我的应用程序可在Android 7上运行,但不能在Android 4.4上运行并关闭该应用程序。

在Android 4.4上运行该应用程序时,logcat中没有特殊错误,但它无法在Android 4.4上运行并关闭该应用程序。

如何修复?

build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "ir.aradteam.persiantoon"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}


}

我的清单:

<?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="ir.aradteam.persiantoon">

    <uses-sdk tools:overrideLibrary="co.ronash.pushe" />
    <permission
        android:name="ir.aradteam.persiantoon.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="ir.aradteam.persiantoon.permission.C2D_MESSAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

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


    <application
        android:name="ir.aradteam.persiantoon.G"
        android:allowBackup="false"
        android:icon="@drawable/logo"
        android:label="@string/app_name"
        android:roundIcon="@drawable/logo"
        android:supportsRtl="false"
        android:theme="@style/AppTheme"
        tools:replace="allowBackup,supportsRtl"
        >

        <activity android:name=".SplachScreen.SplashScreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>

        <activity
            android:name="ir.aradteam.persiantoon.ShowVideo.ShowVideoActivity"
            android:screenOrientation="portrait" />

        <activity
            android:name="ir.aradteam.persiantoon.Search.ActivitySearch"
            android:screenOrientation="portrait" />
        <activity
            android:name="ir.aradteam.persiantoon.login.ActivityLogin"
            android:screenOrientation="portrait" />
        <activity
            android:name="ir.aradteam.persiantoon.Gallery.ActivityGallery"
            android:screenOrientation="portrait" />
        <activity
            android:name="ir.aradteam.persiantoon.Comments.ActivityComments"
            android:screenOrientation="portrait" />
        <activity
            android:name="ir.aradteam.persiantoon.ShowVideo.PlayVideo"
            android:screenOrientation="landscape"
            android:theme="@style/prograssBar" />
        <activity
            android:name="ir.aradteam.persiantoon.MainActivity"
            android:screenOrientation="portrait">
            <intent-filter>

                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:host="zarinpalpayment"
                    android:scheme="return" />

            </intent-filter>
        </activity>


        <receiver android:name="co.ronash.pushe.receiver.UpdateReceiver">
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_REPLACED" />

                <data
                    android:path="ir.aradteam.persiantoon"
                    android:scheme="package" />
            </intent-filter>
        </receiver>
        <receiver
            android:name="com.google.android.gms.gcm.GcmReceiver"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />

                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="ir.aradteam.persiantoon" />
            </intent-filter>
        </receiver>

        <meta-data
            android:name="co.ronash.pushe.token"
            android:value="PUSHE_429459318441" />
        <meta-data
            android:name="co.ronash.pushe.cr"
            android:value="Tm9uZQ==" />

        <receiver android:name="co.ronash.pushe.receiver.UpdateReceiver">
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_REPLACED" />

                <data
                    android:path="ir.aradteam.persiantoon"
                    android:scheme="package" />
            </intent-filter>
        </receiver>
        <receiver
            android:name="com.google.android.gms.gcm.GcmReceiver"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />

                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="ir.aradteam.persiantoon" />
            </intent-filter>
        </receiver>
        <meta-data
            android:name="co.ronash.pushe.token"
            android:value="PUSHE_429459318441" />
        <meta-data
            android:name="co.ronash.pushe.cr"
            android:value="Tm9uZQ==" />
    </application>

</manifest>

1 个答案:

答案 0 :(得分:0)

将其减少到最低限度,只需执行一项空的活动,没有任何权限或任何过滤器,然后查看其是否有效。然后开始添加东西。

另外,您的compileSdkVersion和您的targetSdkVersion应该与您的情况相同,并且我发现您从摇篮中丢失了buildToolVersion。我认为它现在已经包含在包装器中或某个位置,但是您不应该依赖它,而是声明自己的包装器,这样就可以在新版本发布时进行升级。 而且您缺少debug buildType,那里只有一个发行版。所以问题是,您是否尝试过在应用程序中放置一个断点以查看它是否甚至被启动?