在android rom中编译应用程序时出错。 (APK空)

时间:2016-01-22 12:05:25

标签: android compilation android-5.1.1-lollipop

尝试使用 mm 构建apk时出现以下错误。

Reading program jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/APPS/HelloWorld_intermediates/classes.jar]
Reading library jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/JAVA_LIBRARIES/core-junit_intermediates/classes.jar]
Reading library jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar]
Reading library jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar]
Reading library jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar]
Error: The output jar is empty. Did you specify the proper '-keep' options?
make: *** [out/target/common/obj/APPS/HelloWorld_intermediates/proguard.classes.jar] Error 1

#### make failed to build some targets (20 seconds) ####

这些是我的生成文件 Android.mk

的内容
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_SRC_FILES := $(call all-subdir-java-files)

LOCAL_PACKAGE_NAME := HelloWorld

include $(BUILD_PACKAGE)

include $(call all-makefiles-under,$(LOCAL_PATH))

这是我的 AndroidManifest.xml

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".HelloWorld"
            android:label="@string/app_name" 
            android:windowSoftInputMode="stateAlwaysHidden">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.APP_HELLOWORLD" />
            </intent-filter>
        </activity>
    </application>
</manifest>

上面的应用程序在android工作室编译得很好。要在我用来编译Rom的相同环境中编译它,我必须删除预构建的R文件。有什么建议可以帮助编译这个应用程序吗?

2 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。将LOCAL_PROGUARD_FLAG_FILES := proguard.flags添加到Android.mk并创建标记文件。

-keep class com.yourpackage.* {
  *;
}

答案 1 :(得分:0)

我错了,问题不在于progard.flags文件,我试图编译一个用Gradle编写的应用程序,因为andriod ROM编译环境支持ANT。