【问题标题】:Add Multidex package along my other package沿着我的其他包添加 Multidex 包
【发布时间】:2016-10-05 17:59:07
【问题描述】:

我想在 Android Manifest 里面添加这行代码:

package="com.example.android.multidex.myapplication"

但我的应用程序包已经在那里了,在我看来我无法添加 multidex 包。我该怎么办?

我的 Android 清单:

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

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

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

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

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

        <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".MainActivity" />

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

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".EventCreate"
            android:parentActivityName=".MainActivity">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".EventCreate" />

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

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

        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />

        <activity
            android:name=".MapsActivity"
            android:label="@string/title_activity_maps"></activity>
         -->android:name="android.support.multidex.MultiDexApplication">
    </application>
</manifest>

【问题讨论】:

  • 你在哪里添加了 android:name 应用标签?
  • application标签内
  • @KhizarHayat 我在 xml 代码中添加了 android:name。
  • 你没有添加上面的代码。你能在添加后更新xml然后告诉我你的需要吗

标签: android package manifest


【解决方案1】:

&lt;manifest&gt; 包属性不是您应该查看的。您想告诉 android 应用程序将使用 Application 的哪个子类作为应用程序。为此,您需要做的就是在 &lt;application&gt; 元素上设置 name 属性。

另一方面,Multidex 通常是一场噩梦。我建议查看您的依赖项以尝试减少它们。 Play Services 通常是罪魁祸首,但它们确实有用于各个功能的库。见https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project

【讨论】:

  • 我删除了 Multidex,我只是从 google play services 编译了我想要的特定包。所以,现在我对 64K 方法没有任何问题。谢谢!
猜你喜欢
  • 1970-01-01
  • 2019-02-26
  • 2015-12-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多