11

I have the following Application.mk

APP_PLATFORM := android-9
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions -O2 -mfpu=neon -mfloat-abi=softfp
APP_ABI := armeabi-v7a
LOCAL_ARM_NEON := true

and when running ndk-build I always get the warnings:

Invalid attribute name: 
    package
/Users/tmanthey/Documents/android/android-ndk-r8d/build/core/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion  in ./AndroidManifest.xml    
Invalid attribute name: 
    package

This is my AndroidManifest.xml

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

    <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17" />

    <uses-permission android:name="android.permission.CAMERA" />

    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.VIBRATE"/>

    <application
        android:name=".ACoDriverApp"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" android:allowBackup="true">
        <activity
            android:name=".ACoDriverActivity"
            android:label="@string/app_name" android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

How can I get rid of these warnings?

tmanthey
  • 4,547
  • 6
  • 35
  • 42

3 Answers3

3

Regarding "package", this is most likely some crlf problem with your XML file. Check the line end characters there. Or, maybe something is wrong in your project.properties file.

The APP_PLATFORM warning is actually correct: your APP_PLATFORM (android-14) is larger than android:minSdkVersion you set in AndroidManifest.xml. This is only a warning to remind you about this (legitimate) situation, so that at certain stage you decide to drop support for very dated devices.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • the manifest? It ends with bracket ">" but the line delimiter in the file is CRLF. Where did I set the APP_PLATFORM to 14? I thought I set it to 9. – tmanthey Apr 02 '13 at 10:54
  • 1
    YOu are on Linux, but AndroidManifest.xml file has DOS (Windows) line delimeters... This could be a problem. Try to convert the file to Unix style line endings. – Alex Cohn Apr 02 '13 at 11:51
  • Please check that your Application.mk file is actually used. Note that ndk-build looks for this file in the jni directory, and will silently use a default one if it cannot find one. The easiest way is to add some error to your Application.mk and see ndk-build stop. – Alex Cohn Apr 02 '13 at 11:57
  • On a mac this is fixing it: `cat AndroidManifest.xml | col -b > AndroidManifest.xml2; mv AndroidManifest.xml2 AndroidManifest.xml` – tmanthey Apr 02 '13 at 13:12
  • Is APP_PLATFORM from `Application.mk` recognized after that? – Alex Cohn Apr 02 '13 at 20:15
  • 1
    I removed APP_PLATFORM from Application.mk but still the APP_PLATTFORM warning is gone since I removed CR from AndroidManifest.xml – tmanthey Apr 04 '13 at 07:17
3

For NDK rev r9 (works in others too but line# may differ)

${NDK}/build/core/add-application.mk line 138

add "#" at start of the line.

# $(call __ndk_info,WARNING: APP_PLATFORM $(APP_PLATFORM) is larger than android:minSdkVersion $(APP_MIN_PLATFORM_LEVEL) in $(APP_MANIFEST))

One character, 30 second fix ... go debug native code.

DevByStarlight
  • 1,070
  • 13
  • 17
1

You can fix this by performing the following steps in Eclipse:

  • Window -> Preferences -> C/C++ -> Build -> Settings
  • Select CDT GNU C/C++ Error Parser
  • In the Error Parser options at the bottom, add a new entry with the following contents:

Severity: Warning

Pattern: (.?):(\d+): Android NDK: WARNING:(.)

File: $1

Line: $2

Description: $3

That should convert this to a warning, and you can choose to ignore this as well - depending on the severity it will show up in the Problems view.

raja
  • 368
  • 2
  • 13