簡體   English   中英

在ant應用程序上運行lint會產生明顯錯誤

[英]running lint on ant app gives manifest error

我有以下清單:

<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.example.mfc"
    android:versionCode="1"
    android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="17" />
   <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <application  android:label="@string/app_name">
          <activity android:name=".Home" android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
          </activity>
   </application>
</manifest>

但是在運行lint時,我得到警告“正確性”:'com.example.mfc.Home未在清單中注冊

問題:確保活動,服務和內容提供者已在清單ID中注冊:已注冊

活動,服務和內容提供者應使用和標簽在AndroidManifest.xml文件中注冊。

如果您的活動只是打算由其他“實際”活動子類化的父類,則將其設為抽象類。

[http://developer.android.com/guide/topics/manifest/manifest-intro.html]”

雖然有,但我有家庭擴展活動類:

package com.example.mfc;

import java.io.IOException;
import android.os.Bundle;
import android.app.Activity;
//import android.content.Intent;
import android.view.Menu;
import android.view.View;
//import android.view.View;
//import android.support.v7.app.ActionBar;
import static us.monoid.web.Resty.*;
import us.monoid.web.Resty;
//import us.monoid.web.Resty.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
public class Home extends Activity  {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.home, menu);
        return true;
    }

    public void Register(View arg0) {

        try{
             new Resty().json("http://app.zkn-web.com/register");

        /*  new AlertDialog.Builder(this)
            .setTitle("Invalid email")
            .setMessage("Invalid email address")
             .show();
            */
            //Resty r = new Resty();
            //Object name = r.json("http://app.zkn-web.com/register").get("status");

        } catch(IOException ioEx) {
            ioEx.printStackTrace(); // or what ever you want to do with it
        }

    }



}

嘗試運行該項目時也出現錯誤,``無法啟動android庫項目'',這與清單有關嗎?

嘗試改變

  <activity android:name=".Home" android:label="@string/app_name">

至:

      <activity android:name="com.example.mfc.Home" android:label="@string/app_name">

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM