【问题标题】:Error in AndroidManifest.xml "must have a minimum of 2 segments"AndroidManifest.xml 中的错误“必须至少有 2 个段”
【发布时间】:2012-11-05 05:17:28
【问题描述】:

我尝试更改我的包名称,如 com.project_name,但没有成功。我的项目中真正的问题是什么?

我收到以下错误:

AndroidManifest.XML 文件中的错误“应用程序包 'AndroidManifest.xml' 必须至少有 2 个段”

AndroidManifest.XML 文件;

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

    <uses-sdk
        android:maxSdkVersion="15"
        android:minSdkVersion="7" />

    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true" />

    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name" >
        <activity
            android:name=".splash"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

【问题讨论】:

  • 应该是com.something.project_name,我是怎么做的:com.bigflow.project_name
  • com.project_name 是可以接受的。 @Serkan 你是如何更改你的包名的?通过重构?
  • 首先,您是如何创建一个包含单个包段的项目的?
  • 请出示您的 Manifest.xml 文件和您的主要活动包名称,这会有所帮助
  • @Asok 是的,我通过重构改变了->重命名

标签: android error-handling manifest


【解决方案1】:

这可能是一个红鲱鱼。我从来没有得到它,因为我一直使用完整的公司层次结构(这肯定超过了两个层次的深度)。你没有显示(为什么你会知道显示它?)你的主 ListActivity 代码的包名。假设这是 RssReader.java:它必须位于 com.rssreader.RssReader.java。那应该这样做。如果您发现您的主要活动不在那个地方,请修复它。如果它仍然不起作用,那么在您的包名称中添加一个额外的层次结构并尝试它,这肯定应该解决它。希望这会有所帮助。

【讨论】:

    【解决方案2】:

    至少当我从这个页面开始创建项目时
    http://docs.phonegap.com/en/2.3.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android

    我遇到了完全相同的问题。使用以下命令创建项目解决了这个问题。

    .\create c:\html\myapp **com.**my_package my_app
    

    在原始说明中,com. 缺失。
    这解决了我的问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-07
      • 2019-04-27
      • 2022-06-16
      • 2014-09-13
      相关资源
      最近更新 更多