构建失败,缺少关键属性(Android SDK)
Posted
技术标签:
【中文标题】构建失败,缺少关键属性(Android SDK)【英文标题】:Build Failed, Missing Key Attribute (Android SDK) 【发布时间】:2016-02-25 20:21:42 【问题描述】:我最近将我的项目从 Eclipse ADT 导入到 android SDK。我正在尝试重新运行我的模拟器,但我的 AndroidManifest.xml 文件出现问题,该文件指出:/Users/####/Documents/android/medicine/src/main/AndroidManifest.xml:13:13-30 Error: Missing one of the key attributes 'action#name,category#name' on element intent-filter at AndroidManifest.xml:13:13-30
我在 Google 上搜索了错误,但没有找到任何可靠的信息。这个错误是否有原因,我假设是因为 Android 版本?对此的任何帮助都会很棒。
下面是我的 AndroidManifest.xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest android:hardwareAccelerated="true" android:versionCode="20101" android:versionName="2.1.1" android:windowSoftInputMode="adjustPan" package="com.medicine" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="Med Finder">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:launchMode="singleTop" android:name="Medicine" android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="@string/app_name" android:name="org.pgsqlite.SQLitePlugin">
<intent-filter />
</activity>
<receiver android:exported="true" android:name="com.google.ads.conversiontracking.InstallReceiver">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
<intent-filter>
<action android:name="com.medicine.MESSAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id" />
<receiver
android:name="com.pushbots.google.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.medicinefinder" />
</intent-filter>
</receiver>
<receiver android:name="com.pushbots.push.DefaultPushHandler" />
<service android:name="com.pushbots.push.GCMIntentService" />
</application>
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission android:name="com.medicine.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.medicine.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive dataf message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<activity android:name="com.mopub.mobileads.MoPubActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.common.MoPubBrowser" android:configChanges="keyboardHidden|orientation|screenSize"/>
</manifest>
【问题讨论】:
检查你的这些行:检查你的这些行:
<activity android:label="@string/app_name" android:name="org.pgsqlite.SQLitePlugin">
<intent-filter />
</activity>
在这里您定义了意图过滤器,但没有任何操作,因此如果您不想在此处指定任何操作,只需将其删除或添加您想要收听的任何操作,
【讨论】:
以上是关于构建失败,缺少关键属性(Android SDK)的主要内容,如果未能解决你的问题,请参考以下文章
Android studio 出现缺少sdk的情况,如何解决?
如何修复“构建失败:未指定 Android SDK 目录,正在退出。”