gpt4 book ai didi

android - 错误:在< list > <应用程序>中找到意外元素

转载 作者:行者123 更新时间:2023-12-03 04:47:15 24 4
gpt4 key购买 nike

我正在尝试构建this android vlctest应用程序示例,但是出现以下错误:

Android resource linking failed
Output: C:\Program Files\android\workspace\vlctest-master\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml:42: error: unexpected element <uses-sdk> found in <manifest><application>.

Command: C:\Program Files\android\android-studio\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\466069e667720c031ae71c30fd5dfaa7\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
E:\android\Sdk\platforms\android-28\android.jar\
--manifest\
C:\Program Files\android\workspace\vlctest-master\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
-o\
C:\Program Files\android\workspace\vlctest-master\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
@C:\Program Files\android\workspace\vlctest-master\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
C:\Program Files\android\workspace\vlctest-master\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--custom-package\
com.sxx.vlctest\
-0\
apk\
--output-text-symbols\
C:\Program Files\android\workspace\vlctest-master\app\build\intermediates\symbols\debug\R.txt\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

请注意,错误中提到的 list XML( AndroidManifest.xml )是构建目录下的自动生成文件,因此对它的任何更改都将在同步后重置。

AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sxx.vlctest"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="26" />

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:name="com.sxx.vlctest.VLCApplication"
android:allowBackup="true"
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
android:debuggable="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity
android:name="com.sxx.vlctest.MainActivity"
android:label="@string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" />

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

<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="26" />
</application>

</manifest>

我认为我的app gradle也可能会有所帮助:
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
applicationId "com.sxx.vlctest"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:+'
implementation 'com.android.support:design:28.0.0'
implementation project(':libvlc-3.0.0')
}

编辑:

以下是我的主要 list 文件,位于“app / src / main / AndroidManifest.xml”下:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sxx.vlctest">

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

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<application
android:name="com.sxx.vlctest.VLCApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" />

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

</manifest>

该图像可能也有帮助:

Check this image
谢谢。

最佳答案

实际上在此.aar文件中的以下位置找到了令人讨厌的 list 文件:

vlctest-master\vlctest-master\libvlc-3.0.0\libvlc-3.0.0.aar

.aar文件只是带有自定义扩展名的.zip文件。因此,将其重命名为.zip,将其解压缩,从 list 文件中删除“uses-sdk”行,重新压缩,将其重命名为.aar,您就完成了!完成所有这些操作后,Gradle为我成功同步。

关于android - 错误:在< list > <应用程序>中找到意外元素<uses-sdk>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53103681/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com