2017-07-25 87 views
0

嘗試在Mac上的android studio中構建離子項目,錯誤如下,任何人都可以提供一些線索。Android build AndroidManifest.xml錯誤

Element uses-feature#android.hardware.camera at AndroidManifest.xml:32:5-84 duplicated with element declared at AndroidManifest.xml:27:5-60 

刪除重複條目仍然不起作用。

AndroidManifest.xml文件。

<?xml version='1.0' encoding='utf-8'?> 
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" 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> 
     <activity android:name="com.cordovaplugincamerapreview.CameraActivity" android:screenOrientation="portrait" android:theme="@style/CameraPreviewTheme" /> 
     <receiver android:name="cordova.plugins.Diagnostic$LocationProviderChangedReceiver"> 
      <intent-filter> 
       <action android:name="android.location.PROVIDERS_CHANGED" /> 
      </intent-filter> 
     </receiver> 
     <receiver android:name="cordova.plugins.Diagnostic$NFCStateChangedReceiver"> 
      <intent-filter> 
       <action android:name="android.nfc.action.ADAPTER_STATE_CHANGED" /> 
      </intent-filter> 
     </receiver> 
     <activity android:clearTaskOnLaunch="true" android:configChanges="orientation|keyboardHidden|screenSize" android:exported="false" android:name="com.google.zxing.client.android.CaptureActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden" /> 
     <activity android:label="Share" android:name="com.google.zxing.client.android.encode.EncodeActivity" /> 
    </application> 
    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25" /> 
    <uses-feature android:name="android.hardware.camera" /> 
    <uses-feature android:name="android.hardware.camera.autofocus" /> 
    <uses-permission android:name="android.permission.CAMERA" /> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
    <uses-permission android:name="android.permission.FLASHLIGHT" /> 
    <uses-feature android:name="android.hardware.camera" android:required="true" /> 
</manifest> 

移除的條目:

新AndroidManifest.xml文件。

<?xml version='1.0' encoding='utf-8'?> 
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" 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> 
     <activity android:name="com.cordovaplugincamerapreview.CameraActivity" android:screenOrientation="portrait" android:theme="@style/CameraPreviewTheme" /> 
     <receiver android:name="cordova.plugins.Diagnostic$LocationProviderChangedReceiver"> 
      <intent-filter> 
       <action android:name="android.location.PROVIDERS_CHANGED" /> 
      </intent-filter> 
     </receiver> 
     <receiver android:name="cordova.plugins.Diagnostic$NFCStateChangedReceiver"> 
      <intent-filter> 
       <action android:name="android.nfc.action.ADAPTER_STATE_CHANGED" /> 
      </intent-filter> 
     </receiver> 
     <activity android:clearTaskOnLaunch="true" android:configChanges="orientation|keyboardHidden|screenSize" android:exported="false" android:name="com.google.zxing.client.android.CaptureActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden" /> 
     <activity android:label="Share" android:name="com.google.zxing.client.android.encode.EncodeActivity" /> 
    </application> 
    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25" /> 
    <uses-feature android:name="android.hardware.camera.autofocus" /> 
    <uses-permission android:name="android.permission.CAMERA" /> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
    <uses-permission android:name="android.permission.FLASHLIGHT" /> 
    <uses-feature android:name="android.hardware.camera" android:required="true" /> 
</manifest> 

新的錯誤:

Merging Errors: Error: Attribute meta-data#[email protected] value=(26.0.0-alpha1) from AndroidManifest.xml:27:9-38 is also present at AndroidManifest.xml:24:9-31 value=(25.3.1). Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:41 to override. android main manifest (this file), line 26 
+0

您的相機的重複權限 –

+1

你只需要一個申報。 –

+0

刪除了重複的條目,錯誤仍然存​​在,但不同。合併錯誤:錯誤:屬性meta-data#[email protected] value =(26.0.0-alpha1)from AndroidManifest.xml:27:9-38也出現在AndroidManifest.xml:24:9-31值=(25.3.1)。建議:在AndroidManifest.xml:25:5-27:41處添加'tools:replace =「android:value」'至元素以覆蓋。 android main manifest(這個文件),第26行 –

回答

0

你在你的XML文件的末尾有重複<uses-feature android:name="android.hardware.camera" />

從Menifest文件中刪除相機的任何權限。

0

您有<uses-feature android:name="android.hardware.camera" /><uses-feature android:name="android.hardware.camera" android:required="true" />。刪除一個不需要的。

相關問題