【问题标题】:Importing android projects that do not have android manifest file导入没有 android manifest 文件的 android 项目
【发布时间】:2013-03-24 16:22:15
【问题描述】:

我目前正忙于为我的主要项目设计自定义视图。我浏览了 developer.android.com 提供的自定义视图教程。我下载了相关的可共享项目,因为当源代码在您面前时,它很容易处理和理解应用程序的机制。令我惊讶的是,该项目仅包含 src 和 res 两个文件夹,并且没有 android-manifest 文件。我尝试了正常的导入方法,从现有代码导入并从现有的 android 代码创建新项目,任何方法都没有运气。这里是project.的链接

有人可以向我解释一下如何让它工作吗?

【问题讨论】:

    标签: android import


    【解决方案1】:

    有人可以向我解释一下如何让它工作吗?

    创建一个空的 Android 项目。从 ZIP 文件中复制 res/src/。修改清单以指向您从 ZIP 文件复制的活动类。

    【讨论】:

    • 我曾经在另一个项目中尝试过这种方法,但可能由于我自己的无知而遇到了一些大问题。谢谢。
    【解决方案2】:

    创建一个新的空 android 项目。将所有资源和源文件复制到您的项目文件夹。

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

    转到 AndroidManifest.xml 相应地定义活动和权限。

     <?xml version="1.0" encoding="utf-8"?>
     <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="package name"
      android:versionCode="1"
      android:versionName="1.0" >
    
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
    
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="packagename.MainActivity"//your mainactivity
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
    
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
           <activity
            android:name="packagename.SecondActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="packagename.SecondActivity" />
    
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>
    

    【讨论】:

    • 看来 CommonsWare 打败了你。
    • 我的答案和评论一样。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-14
    • 1970-01-01
    • 2013-03-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多