Ionic / Cordova应用程序不会为Android构建

时间:2017-07-14 01:41:39

标签: angular cordova ionic-framework

我正在尝试为Android构建我的Ionic / Cordova应用程序,但它不会构建。它适用于iOS,但在我尝试为Android构建时仍然说错误。这是错误:

Error: Attribute meta-data#android.support.VERSION@value value=(25.3.1) from 
[com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31 is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1). Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

        :processReleaseManifest FAILED

        FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':processReleaseManifest'.
        > Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31 is also present [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1). Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.

        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

        BUILD FAILED

FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':processReleaseManifest'.
        > Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31
                is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value
=(26.0.0-alpha1).
                Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-
27:34 to override.

这是我的清单文件。在错误消息中,它说&#34;添加&#39;工具:replace =&#34; android:value&#34;&#39;到AndroidManifest.xml:25:5-27:34的元素覆盖。&#34;但我不知道这意味着什么。如果你知道我应该做什么编辑,请告诉我。

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="6" android:versionName="0.0.6" package="com.squadthink.app" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="android.support.v4.content.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
        </provider>
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/fb_app_id" />
        <meta-data android:name="com.facebook.sdk.ApplicationName" android:value="@string/fb_app_name" />
        <activity android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/fb_app_name" android:name="com.facebook.FacebookActivity" />
        <activity android:exported="true" android:launchMode="singleTop" android:name="com.gae.scaffolder.plugin.FCMPluginActivity">
            <intent-filter>
                <action android:name="FCM_PLUGIN_ACTIVITY" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <service android:name="com.gae.scaffolder.plugin.MyFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
        <service android:name="com.gae.scaffolder.plugin.MyFirebaseInstanceIDService">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
            </intent-filter>
        </service>
        <receiver android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.TriggerReceiver" />
        <receiver android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.ClearReceiver" />
        <activity android:exported="false" android:launchMode="singleInstance" android:name="de.appplant.cordova.plugin.localnotification.ClickActivity" android:theme="@android:style/Theme.NoDisplay" />
        <receiver android:exported="false" android:name="de.appplant.cordova.plugin.notification.TriggerReceiver" />
        <receiver android:exported="false" android:name="de.appplant.cordova.plugin.notification.ClearReceiver" />
        <receiver android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.RestoreReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
        <activity android:exported="false" android:launchMode="singleInstance" android:name="de.appplant.cordova.plugin.notification.ClickActivity" android:theme="@android:style/Theme.NoDisplay" />
    </application>
    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</manifest>

2 个答案:

答案 0 :(得分:0)

打开Android SDK Manager并检查是否安装了API 25即Android 7.1.1。这可能会解决您的问题。

答案 1 :(得分:0)

请阅读您的错误日志, “建议:在AndroidManifest.xml中添加'tools:replace =”android:value“'到元素:25:5-27:34以覆盖。

分享您的清单文件以获取更多详细信息,同时更新您的SDK,确保您已检查Android 7.1.1(Nougat)。

我认为你刚刚放置了工具:替换 - 元数据标签外的“android:value”,只是这样做可以修复它。