的Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.piggybank">
<activity
android:name="c.b.a.A"
android:configChanges="orientation|keyboardHidden|navigation"
android:exported="false"
android:screenOrientation="behind"
android:windowSoftInputMode="adjustResize|stateHidden" />
<activity
android:name="c.b.a.B"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent"/>
<!-- 允许联网 -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- 获取wifi网络状态的信息 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- 保持CPU 运转,屏幕和键盘灯有可能是关闭的,用于文件上传和下载 -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- 获取sd卡写的权限,用于文件上传和下载 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- 允许读取手机状态 用于创建BmobInstallation -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!-- android:hardwareAccelerated="false"66666 -->
<activity android:name=".MainActivity1">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity2"
android:label="@string/title_activity_main2"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".EditWishMainActivity" />
<activity android:name=".personalMainActivity" />
<activity android:name=".registMainActivity" />
<activity android:name=".BankMainActivity" />
<activity android:name=".PayMainActivity" />
<activity android:name=".MainActivity" />
<activity android:name=".fragment.WishFragment" />
<activity android:name=".fragment.SuccessFragment" />
<activity android:name=".fragment.DiscoverFragment" />
<activity android:name=".fragment.MeFragment" />
<activity android:name=".fragment.jingxuan_fragment" />
<activity android:name=".fragment.Mytidings_fragment" />
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<activity android:name=".EditDotaiMainActivity" />
<activity android:name=".QianBaoMainActivity"></activity>
</application>
</manifest>
当我构建apk时,它不断发出此错误,但我找不到原因......我不认为我在活动中放了一个活动,但错误就在那里......
错误:(5)错误:元素必须是。的直接子元素 element [WrongManifestParent]错误:(12)错误:元素必须是元素的直接子元素 [WrongManifestParent]
答案 0 :(得分:1)
尝试在Apllication标记中添加活动
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.piggybank">
<!-- 允许联网 -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- 获取GSM(2g)、WCDMA(联通3g)等网络状态的信息 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- 获取wifi网络状态的信息 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- 保持CPU 运转,屏幕和键盘灯有可能是关闭的,用于文件上传和下载 -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- 获取sd卡写的权限,用于文件上传和下载 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- 允许读取手机状态 用于创建BmobInstallation -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!-- android:hardwareAccelerated="false"66666 -->
<activity android:name=".MainActivity1">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="c.b.a.A"
android:configChanges="orientation|keyboardHidden|navigation"
android:exported="false"
android:screenOrientation="behind"
android:windowSoftInputMode="adjustResize|stateHidden" />
<activity
android:name="c.b.a.B"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent"/>
<activity
android:name=".MainActivity2"
android:label="@string/title_activity_main2"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".EditWishMainActivity" />
<activity android:name=".personalMainActivity" />
<activity android:name=".registMainActivity" />
<activity android:name=".BankMainActivity" />
<activity android:name=".PayMainActivity" />
<activity android:name=".MainActivity" />
<activity android:name=".fragment.WishFragment" />
<activity android:name=".fragment.SuccessFragment" />
<activity android:name=".fragment.DiscoverFragment" />
<activity android:name=".fragment.MeFragment" />
<activity android:name=".fragment.jingxuan_fragment" />
<activity android:name=".fragment.Mytidings_fragment" />
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<activity android:name=".EditDotaiMainActivity" />
<activity android:name=".QianBaoMainActivity"></activity>
</application>
另请参阅https://developer.android.com/guide/topics/manifest/manifest-intro.html
答案 1 :(得分:0)
activity
内声明application
。</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns :android="http://schemas.android.co
m /apk/res/android"
package="com.example.piggybank">
<!-- 允许联网 -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- 获取GSM(2g)、WCDMA(联通3g)等网络状态的信息 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- 获取wifi网络状态的信息 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- 保持CPU 运转,屏幕和键盘灯有可能是关闭的,用于文件上传和下载 -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- 获取sd卡写的权限,用于文件上传和下载 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- 允许读取手机状态 用于创建BmobInstallation -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!-- android:hardwareAccelerated="false"66666 -->
<activity android:name=".MainActivity1">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity2"
android:label="@string/title_activity_main2"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".EditWishMainActivity" />
<activity android:name=".personalMainActivity" />
<activity android:name=".registMainActivity" />
<activity android:name=".BankMainActivity" />
<activity android:name=".PayMainActivity" />
<activity android:name=".MainActivity" />
<activity android:name=".fragment.WishFragment" />
<activity android:name=".fragment.SuccessFragment" />
<activity android:name=".fragment.DiscoverFragment" />
<activity android:name=".fragment.MeFragment" />
<activity android:name=".fragment.jingxuan_fragment" />
<activity android:name=".fragment.Mytidings_fragment" />
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<activity android:name=".EditDotaiMainActivity" />
<activity android:name=".QianBaoMainActivity">. </activity>
<activity
android:name="c.b.a.A"
android:configChanges="orientation|keyboardHidden|navigation"
android:exported="false"
android:screenOrientation="behind"
android:windowSoftInputMode="adjustResize|stateHidden" />
<activity
android:name="c.b.a.B"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent"/>
</application>
</manifest>