" AndroidManifest.xml中未声明的Java包"错误 [英] "AndroidManifest.xml does not declare a Java package" error

查看:319
本文介绍了" AndroidManifest.xml中未声明的Java包"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能比一个编程错误Linux的错误,但我不知道。在AndroidManifest.xml中有点希腊给我。这就是说,我的程序编译和运行之前,它目前的状态完全正常的,甚至在市场。它已经一个月左右,因为我已经打开在Eclipse中源,而今天当我打开它,它拒绝编译,并显示以下错误:

  [2010-12-10 10时43分19秒 -  com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper]无法读取/媒体/数据/ code /安卓/ XXX / AndroidManifest.xml中:org.eclipse.core.internal.resources.ResourceException:资源不与文件系统同步的:/XXX/AndroidManifest.xml。

[2010-12-10 10点43分19秒 -  XXX] AndroidManifest.xml中未声明的Java包:构建中止。
 

其中XXX是软件包的名称(和目录它位于)。我已确认该文件是完全正常的文本编辑器,甚至刷新它在Eclipse中。什么也没有。

我更新了ADT ......也许是标准的Andr​​oidManifest.xml变化?

我的Andr​​oidManifest.xml:

 < XML版本=1.0编码=UTF-8&GT?;
<舱单
 的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
 包=com.XXX.XXX
 安卓版code =2
 机器人:VERSIONNAME =1.0.1
 >

 <应用机器人:图标=@可绘制/图标机器人:标签=@字符串/ APP_NAME>

     <活动
      机器人:XXXNAME =
   机器人:标签=@字符串/ APP_NAME
   机器人:screenOrientation =画像

   机器人:主题=@安卓风格/ Theme.NoTitleBar
   >

   <意向滤光器>
    <作用机器人:名称=android.intent.action.MAIN/>
    <类机器人:名称=android.intent.category.LAUNCHER/>

   &所述; /意图滤光器>
  < /活性GT;

  <活动
   机器人:名称=。FindLocationsActivity
   机器人:screenOrientation =画像
   >
  < /活性GT;

  <活动
   机器人:名称=。DeveloperActivity
   机器人:screenOrientation =画像
  >
  < /活性GT;

  <活动
   机器人:名称=。LegalActivity
   机器人:screenOrientation =画像
  >
  < /活性GT;

  <活动
   机器人:名称=。AboutActivity
   机器人:screenOrientation =画像
  >
  < /活性GT;

  <活动
   机器人:SettingsAndAboutActivityNAME =
   机器人:screenOrientation =画像
   >
  < /活性GT;

  <活动
   机器人:名称=。ResultsPageActivity
   机器人:screenOrientation =画像
   >
  < /活性GT;

    < /用途>
<使用-SDK安卓的minSdkVersion =1
/>

< /舱单>
 

解决方案

这异常没有Android的关系:

  

[2010-12-10 10时43分19秒 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper]无法读取/媒体/数据/ code /安卓/ XXX / AndroidManifest。的xml:org.eclipse.core.internal.resources.ResourceException:资源是不与文件系统同步的:'/XXX/AndroidManifest.xml'

这意味着,在Eclipse编辑器加载的文件是不一样的所述一个上的文件系统。

点击Navigator或Package Explorer视图中的资源(甚至更好,Eclipse项目),点击右键,选择刷新。

这是否会彻底解决您的构建问题不会知道,直到你看到文件的实际上的包含。

This may be more of a Linux bug than a programming error, but I am not sure. The AndroidManifest.xml is somewhat Greek to me. That said, my program has compiled and run before in it's current state perfectly fine, it is even on the Market. Its been around a month since I've opened the source in Eclipse, and today when I opened it, it refused to compile and displays the following errors:

[2010-12-10 10:43:19 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Unable to read /media/DATA/code/Android/XXX/AndroidManifest.xml: org.eclipse.core.internal.resources.ResourceException: Resource is out of sync with the file system: '/XXX/AndroidManifest.xml'.

[2010-12-10 10:43:19 - XXX] AndroidManifest.xml does not declare a Java package: Build aborted.

where XXX is the package name (and directory it is located). I have confirmed that the file is perfectly fine in a text editor, and even refreshed it in Eclipse. Nothing.

I updated the ADT...maybe the criteria for AndroidManifest.xml changed?

My AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest 
 xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.XXX.XXX"
 android:versionCode="2"
 android:versionName="1.0.1"
 >

 <application android:icon="@drawable/icon" android:label="@string/app_name">

     <activity 
      android:name=".XXX"
   android:label="@string/app_name"
   android:screenOrientation="portrait"

   android:theme="@android:style/Theme.NoTitleBar"
   >

   <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />

   </intent-filter>
  </activity>

  <activity 
   android:name=".FindLocationsActivity"
   android:screenOrientation="portrait"
   >
  </activity>

  <activity 
   android:name=".DeveloperActivity"
   android:screenOrientation="portrait"
  >
  </activity>

  <activity 
   android:name=".LegalActivity"
   android:screenOrientation="portrait"
  >
  </activity>

  <activity 
   android:name=".AboutActivity"
   android:screenOrientation="portrait"
  >
  </activity>

  <activity 
   android:name=".SettingsAndAboutActivity"
   android:screenOrientation="portrait"
   >
  </activity>

  <activity
   android:name=".ResultsPageActivity"
   android:screenOrientation="portrait"
   >
  </activity>

    </application>
<uses-sdk android:minSdkVersion="1" 
/>

</manifest> 

解决方案

This exception is not Android related:

[2010-12-10 10:43:19 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Unable to read /media/DATA/code/Android/XXX/AndroidManifest.xml: org.eclipse.core.internal.resources.ResourceException: Resource is out of sync with the file system: '/XXX/AndroidManifest.xml'.

It means the file that is loaded in the Eclipse editor is not the same as the one on the filesystem.

Click the resource (or even better, the eclipse project) in the navigator or package explorer view, right click and select 'Refresh.'

Whether or not this will completely fix your build issue won't be known until you see what the file actually contains.

这篇关于&QUOT; AndroidManifest.xml中未声明的Java包&QUOT;错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆