2013-11-22 66 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