当我跑步时
gradle lint
从项目目录或根目录,我得到了大量的报告(对于每个活动和应用程序),如
<issue
id="MissingRegistered"
severity="Error"
message="Class referenced in the manifest, com.mypackage.activities.MyActivity, was not found in the project or the libraries"
category="Correctness"
priority="8"
summary="Ensures that classes referenced in the manifest are present in the project or libraries"
explanation="If a class is referenced in the manifest, it must also exist in the project (or in one of the libraries included by the project. This check helps uncover typos in registration names, or attempts to rename or move classes without updating the manifest file properly."
url="http://developer.android.com/guide/topics/manifest/manifest-intro.html"
urls="http://developer.android.com/guide/topics/manifest/manifest-intro.html"
errorLine1=" <activity"
errorLine2=" ^">
<location
file="AndroidManifest.xml"
line="58"
column="9"/>
</issue>
我确信它们被正确引用,因为在构建之后
gradle build
或
gradle assembleDebug
每个活动都可以启动。
如果重要,我的项目有一些子项目。
settings.gradle
include ':Lib1'
include ':Lib2'
include ':MainProject'
每个活动都列在MainProject的清单中,位于MainProject中。
MainProject / AndroidManifest.xml中
已替换包名称和活动名称,但通用包层次结构表示实际层次结构。我还删除了一些活动,例如留下了两个。所有其他包都在同一个包中,并且与最后一个包定义,只是有不同的名称。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.package"
android:installLocation="auto"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="19" />
<application
android:name="com.my.package.subpackage.MyApp"
android:allowBackup="true"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:largeHeap="true"
android:hardwareAccelerated="true"
android:theme="@style/AppTheme" >
<activity
android:name="com.my.package.subpackage.activities.SplashActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="sensorLandscape"
android:configChanges="orientation|screenSize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.my.package.subpackage.activities.HelpActivity"
android:theme="@style/TransparentTheme"/>
</application>
</manifest>