我在StackOverflow上发布了关于这个问题的类似问题,但没有一个能解决我的问题。
因此,正如在所有问题中一样,我在尝试编译应用程序时遇到错误。
我知道,我不应该将此debug-> AndroidManifest.xml文件编辑为自动生成的文件。但是,app-> AndroidManifest.xml文件没有显示任何错误???当没有错误时我应该编辑什么?
这是我的AndroidManifest.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.awstestapp">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.google.android.c2dm.permission.REGISTER" />
<uses-permission android:name="com.test.awstestapp.permission.C2D_MESSAGE" />
<permission
android:name="com.test.awstestapp.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher_image"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
android:name="com.test.awstestapp.AndroidMobilePushApp"
android:label="@string/app_name"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="com.test.awstestapp.MessageReceivingService"
android:label="com.test.awstestapp.MessageReceivingService">
<intent-filter>
<action android:name="com.test.awstestapp.AndroidMobilePushApp" />
<action android:name="com.test.awstestapp.ExternalReceiver" />
<category android:name="com.test.awstestapp" />
</intent-filter>
</service>
<receiver
android:name="com.test.awstestapp.ExternalReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<action android:name="com.google.android.c2dm.intent.REGISTER" />
<category android:name="com.test.awstestapp" />
</intent-filter>
</receiver>
</application>
</manifest>
build-&gt; ....-&gt; debug中的AndroidManifest.xml文件如下:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.awstestapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.google.android.c2dm.permission.REGISTER" />
<uses-permission android:name="com.test.awstestapp.permission.C2D_MESSAGE" />
<permission
android:name="com.test.awstestapp.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher_image"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.test.awstestapp.AndroidMobilePushApp"
android:label="@string/app_name"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="com.test.awstestapp.MessageReceivingService"
android:label="com.test.awstestapp.MessageReceivingService" >
<intent-filter>
<action android:name="com.test.awstestapp.AndroidMobilePushApp" />
<action android:name="com.test.awstestapp.ExternalReceiver" />
<category android:name="com.test.awstestapp" />
</intent-filter>
</service>
<receiver
android:name="com.test.awstestapp.ExternalReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<action android:name="com.google.android.c2dm.intent.REGISTER" />
<category android:name="com.test.awstestapp" />
</intent-filter>
</receiver>
<!-- Include the AdActivity and InAppPurchaseActivity configChanges and themes. -->
<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="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
android:theme="@style/Theme.IAPTheme" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
<receiver
android:name="com.google.android.gms.wallet.EnableWalletOptimizationReceiver"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.gms.wallet.ENABLE_WALLET_OPTIMIZATION" />
</intent-filter>
</receiver>
</application>
</manifest>
为什么自动生成的清单与原始清单不同?
解决方案一直试用到现在:
答案 0 :(得分:0)
在您的第一个屏幕截图中,我看到两个文件名称下方的红色蠕虫:AndroidMobilePushApp.java和MessageReceivingService.java。 您应该解决这些错误以解决构建问题。这可以神奇地解决您的资源问题,因为在正确构建应用程序,将资源复制到构建映射等之间存在一些依赖关系。
答案 1 :(得分:0)
我猜测Android Studio在IDE外部使用资源管理器复制时无法识别图像。因此,我删除了文件夹,为所有4个drawable创建了新文件夹,并逐个复制文件。现在错误消失了,应用程序就被编译了。
答案 2 :(得分:0)
在android studio中,您必须修改版本的gradle文件