Android 资源链接失败 - 守护程序:AAPT2 aapt2-3.2.0-4818971-windows 守护程序



我将 android studio 升级到 3.2.0 并创建了默认项目。但编译器显示错误:

Android resource linking failed
Output:  D:android1projectalgeriaappbuildintermediatesmerged_manifestsdebugprocessDebugManifestmergedAndroidManifest.xml:54: error: unexpected element <action> found in <manifest><application><service>.
Command: C:Usersnthan.gradlecachestransforms-1files-1.1aapt2-3.2.0-4818971-windows.jar82eccc572f5d84358296092db0bec570aapt2-3.2.0-4818971-windowsaapt2.exe link -I
D:Sdkplatformsandroid-26android.jar
--manifest
D:android1projectalgeriaappbuildintermediatesmerged_manifestsdebugprocessDebugManifestmergedAndroidManifest.xml
-o
D:android1projectalgeriaappbuildintermediatesprocessed_resdebugprocessDebugResourcesoutresources-debug.ap_
-R
@D:android1projectalgeriaappbuildintermediatesincrementalprocessDebugResourcesresources-list-for-resources-debug.ap_.txt
--auto-add-overlay
--java
D:android1projectalgeriaappbuildgeneratednot_namespaced_r_class_sourcesdebugprocessDebugResourcesr
--custom-package

-0
apk
--output-text-symbols
D:android1projectalgeriaappbuildintermediatessymbolsdebugR.txt
--no-version-vectors
Daemon:  AAPT2 aapt2-3.2.0-4818971-windows Daemon #0

我的项目构建分级:

buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

我的模块构建进度:

apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "27.0.1"
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 26
versionCode 3
versionName "2.3"
testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
}
}
buildTypes.each {
it.buildConfigField 'String', 'handsome', black
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso- 
core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.exoplayer:exoplayer:r1.5.3'
implementation 'com.google.code.gson:gson:2.6.2'
implementation 'com.google.firebase:firebase-ads:10.2.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-ads:8.4.0'
testImplementation 'junit:junit:4.12'
}

我的清单:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!--<action android:name="android.intent.action.PHONE_STATE" >-->
<!--</action>-->
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<activity android:name=".InterstitialActivity"></activity>
<service android:name=".service.ForegroundService" >
<action android:name="android.intent.action.PHONE_STATE" />
</service>
</application>

我有最新版本的安卓工作室,我的项目在升级我的毕业生之前运行良好...... 我想不出任何出路。只是为了帮助!!

清单代码中存在问题。 服务标记需要包含意向筛选器标记 在使用动作标签之前!! https://developer.android.com/guide/topics/manifest/service-element 溶液:

<service android:name=".service.ForegroundService" >
<intent-filter> 
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter> 
</service>

相关内容

最新更新