设备上不再显示android应用程序图标

时间:2018-11-03 19:40:48

标签: android react-native

在设备上不再显示Android图标。 (改为查看默认的android图标)

我一如既往使用以下命令:react-native run-android --variant=release

今天,在尝试运行该应用程序时遇到错误,我需要将multiDexEnabled添加到我的build.gradle文件中。

图标文件仍然存在于mipmap目录下。

build.gradle

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "xxx"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 14
        versionName "0.2.3"
        multiDexEnabled true <------- This one is new
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }

AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.android.vending.BILLING" />

<uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="22" />

<application
        android:name=".MainApplication"
        android:allowBackup="true"
        android:label="@string/app_name"
        android:icon="@mipmap/ic_launcher"
        android:theme="@style/AppTheme">


    <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustResize"
            android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <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:scheme="oauthlogin" android:host="login" />
        </intent-filter>
    </activity>
    <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
</application>

我看到的是默认的Android图标,而不是我自己的@mipmap/ic_launcher。而且我没有解决此问题的方法。

1 个答案:

答案 0 :(得分:1)

尝试将图标放入可绘制文件夹中,并更改图标名称,例如data <- matrix(c(6073,1033,1711,3920,3431,2178,357,757,301,332,4204, 364,1006,337,553,7352,690,1356,1910,2066,4695,776, 1267,575,454,3761,352,529,130,658,5523,468,652,146, 312,5027,657,356,107,804,4650,311,674,78,599,4581, 192,581,114,335,1176,65,121,67,195,3841,274,289,71, 425,6489,1912,1784,1041,1434,1487,148,121,62,72, 4130,170,365,353,479,5181,2260,1023,219,502,1286, 1288,890,423,285,2536,289,359,61,424,6237,1504, 1117,179,911),ncol=5,byrow=TRUE) colnames(data) <- c("White","Black","Hispanic","Asian","Unknown") rownames(data) <- c("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S") data <- as.table(data) 愿它为您服务