2013-11-22 144 views
1

引用的类当我运行摇篮皮棉找不到在AndroidManifest.xml

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="  &lt;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中

PACKAGENAME和活动名称所取代,但一般包层次代表了真正的层次结构。我还删除了一些活动,并留下了两个例子。所有其他人都在同一个包中,并且像最后一个一样定义,只是具有不同的名称。

<?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> 
+0

添加您的清单 –

+0

@PankajKumar添加了清单。 –

回答

0

正如tech doc所述,Gradle不支持lint功能。在Gradle稳定之前,您可能会遇到很多问题

+0

它看起来像现在是固定的。 –

+0

是的,从0.7.0版本的构建工具起作用 – cooperok