AndroidManifest 抱怨 Element Application(and MultiDexApplication) is not allowed here
AndroidManifest complains Element Application(and MultiDexApplication) is not allowed here
如果这看起来像是重复的,我很抱歉 post。相信我,事实并非如此。我搜索了整个 Whosebug 和互联网,但找不到任何有用的解决方案。
一切都很好,直到我将这行添加到我的 android 工作室
compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0'
compile ‘com.google.zxing:core:3.2.1’
然后我意识到该应用程序无法构建。关于重复方法声明 BarcodeFormat.class..... 我将第二行替换为
compile('com.github.kenglxn.QRGen:android:2.1.0') {
exclude group: 'com.google.zxing', module: 'core'
}
我建了,而且很成功。现在,AndroidManifest 以及所有组成 Activity 标签不再识别应用程序标签。因此启动器 activity 不能位于 apk 安装上。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ng.softworks.unorthodox.iretriever" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<MultiDexApplication
android:name=".app.VolleyController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity android:name=".activity.App_Splashscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.MainActivity" >
</activity>
<activity android:name=".activity.AddLostListing" >
</activity>
<activity android:name=".activity.AddFoundListing" >
</activity>
</MultiDexApplication>
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "ng.softworks.unorthodox.iretriever"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(':volley')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.github.javiersantos:MaterialStyledDialogs:1.4'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0'
compile('com.github.kenglxn.QRGen:android:2.1.0') {
exclude group: 'com.google.zxing', module: 'core'
}
compile 'com.android.support:multidex:1.0.1'
}
请帮助我。这让我抓狂,因为我找不到要解决的具体错误!
重复的方法声明是由于 com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0 通过 core.jar
捆绑了它自己的 zxing 版本
如果您要使用该库,则应确保排除 core.jar。
或者确保 zxing 不包含在其他地方。
原来同时使用 Zing 和 QRCodeReaderView 最初搞砸了项目内部。我不得不迁移到一个新项目,这一次,添加了对 QRGen(排除了 Zing 的 core.jar)和 QRCodereaderview 的依赖。效果很好。
如果这看起来像是重复的,我很抱歉 post。相信我,事实并非如此。我搜索了整个 Whosebug 和互联网,但找不到任何有用的解决方案。
一切都很好,直到我将这行添加到我的 android 工作室
compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0'
compile ‘com.google.zxing:core:3.2.1’
然后我意识到该应用程序无法构建。关于重复方法声明 BarcodeFormat.class..... 我将第二行替换为
compile('com.github.kenglxn.QRGen:android:2.1.0') {
exclude group: 'com.google.zxing', module: 'core'
}
我建了,而且很成功。现在,AndroidManifest 以及所有组成 Activity 标签不再识别应用程序标签。因此启动器 activity 不能位于 apk 安装上。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ng.softworks.unorthodox.iretriever" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<MultiDexApplication
android:name=".app.VolleyController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity android:name=".activity.App_Splashscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.MainActivity" >
</activity>
<activity android:name=".activity.AddLostListing" >
</activity>
<activity android:name=".activity.AddFoundListing" >
</activity>
</MultiDexApplication>
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "ng.softworks.unorthodox.iretriever"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(':volley')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.github.javiersantos:MaterialStyledDialogs:1.4'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0'
compile('com.github.kenglxn.QRGen:android:2.1.0') {
exclude group: 'com.google.zxing', module: 'core'
}
compile 'com.android.support:multidex:1.0.1'
}
请帮助我。这让我抓狂,因为我找不到要解决的具体错误!
重复的方法声明是由于 com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0 通过 core.jar
捆绑了它自己的 zxing 版本如果您要使用该库,则应确保排除 core.jar。
或者确保 zxing 不包含在其他地方。
原来同时使用 Zing 和 QRCodeReaderView 最初搞砸了项目内部。我不得不迁移到一个新项目,这一次,添加了对 QRGen(排除了 Zing 的 core.jar)和 QRCodereaderview 的依赖。效果很好。