代码之家  ›  专栏  ›  技术社区  ›  Ali

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

  •  -2
  • Ali  · 技术社区  · 6 年前

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

    我的应用程序运行在android 7上,但它不运行在android 4.4上,并且退出应用程序。

    当在android 4.4上运行应用程序时,logcat中没有特殊错误,但它没有在android4.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 回复  |  直到 6 年前
        1
  •  0
  •   sea cat    6 年前

    把它减少到最低限度,只需要一个空的活动,没有任何权限或任何类型的过滤器,看看它是否工作。然后开始添加东西回来。

    还有,你的 compileSdkVersion 你的 targetSdkVersion 对你来说应该是一样的,我知道你错过了 buildToolVersion 从你的毕业典礼上。我认为现在已经包含在包装器或其他地方了,但是您不应该依赖它,声明您自己的,这样您可以在新版本出来时升级。 你错过了 debug buildType ,你只有一个释放。所以问题是,你有没有试着在应用程序中设置一个断点,看看它是否被旋转起来?