android - 我该如何解决这个错误: ParseError at [row,col]:[21,35]
问题描述
错误:
ParseError at [row,col]:[21,35] 消息:http ://www.w3.org/TR/1999/REC-xml-names-19990114#AttributePrefixUnbound?TextView&app:layout_constraintBottom_toBottomOf&app
AndroidManifest 文件:
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.SwitchStuff">
<activity android:name=".Login">
<category android:name="android.intent.category.LAUNCHER" />
</activity>
<activity android:name=".SignUp" />
<activity android:name=".MainActivity">
<action android:name="android.intent.action.MAIN" />
</activity>
</application>
build.gradle 文件:
plugins { id 'com.android.application' }
android { compileSdkVersion 30 buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.mkrsudios.switchstuff"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'com.github.VishnuSivadasVS:Advanced-HttpURLConnection:1.2'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.google.android.material:material:1.5.0-alpha01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
我不知道这个错误可能在哪里,但通过我的研究,这些文件中的任何一个
解决方案
请注意,category
和action
标签意味着在intent-filter
标签内,而不是标签的直接子代activity
:
所以替换:
<activity android:name=".Login">
<category android:name="android.intent.category.LAUNCHER" />
</activity>
<activity android:name=".MainActivity">
<action android:name="android.intent.action.MAIN" />
</activity>
和:
<activity android:name=".Login">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
您还需要使用发生错误的布局 xml 文件更新您的答案ParseError
,以帮助您解决它。
推荐阅读
- c# - 需要帮助在 HotChocolate Filters 中创建求和聚合操作
- django - + 不支持的操作数类型:“QuerySet”和“QuerySet”
- excel - 使用 URL 将行数据复制到另一行?
- c# - 在 .Net Core 中捕获 Polly 中的最后一个异常?
- matlab - 如何使用 Doolittle 方法解释此 MATLAB 代码以进行 LU 分解?
- java - 无法将 C++ 项目与 Gradle 正确链接(使用外部系统时出现异常)
- excel - 超过 21 个值的验证下拉列表崩溃
- python - 列表元素未更新?
- python - 如何让python执行异常,而不是忽略它(discord.py)
- python - Pandas - 按其中一个使用键的两列对数据帧进行排序