Android NDK: WARNING: APP_PLATFORM android-9 is larger than android:minSdkVersion 8
Asked Answered
L

3

42

I am getting the following warning when compiling my cocos2d-x project with cygwin.

`/cygdrive/e/project/MyGame/proj.android `
/cygdrive/e/android-ndk-r8e/build/core/add-application.mk:128: Android NDK: WARNING:APP_PLATFORM android-9 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml

I am using NDK version r8e. My minimum SDK version is 8 in my AndroidManifest.xml but i do not specify APP_PLATFORM as android-9 anywhere. How can i change this to 8.

Can anyone tell me how to solve this warning as I think this may cause issues.

Liberate answered 8/4, 2013 at 6:1 Comment(3)
What's the SDK version are you using?Humidistat
FWIW, it is fixed in NDK r9 somethingSlavin
Possible duplicate of How Get rid of NDK compiler warning: "APP_PLATFORM is larger.." and "Invalid package". Also see WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion in /home/user/MyApp/AndroidManifest.xml.Vacua
F
60

It seems that you are using Android-9 as runtime. You can put APP_PLATFORM := android-8 in your Application.mk file and the warning will disappear.

Fathom answered 8/4, 2013 at 20:7 Comment(3)
Does this have any impact?Amortize
Well, you must be sure that your native code satisfy this constraint, e.g. works on the given platform.Fathom
For gradle experimental see this answer: https://mcmap.net/q/391769/-how-do-you-set-app_platform-in-gradle-ndk-plug-in-in-android-studioHeteromerous
I
13

The reason behind the warning/error is it wants to let you know it's compiling the native code for a target platform higher than your "minimum" spcefied in the manifest. It's basically saying 'be careful about using features not supported on the older OS. The Application.mk change is okay and shouldn't have any real adverse affects on the compiled code.

~~ Alternative solutions.

For r8 you can change the build settings to consider it a warning rather than an error. This worked in r8 but is only a partial fix in r9.

For NDK rev r9 (works in others revs too but location/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.

Intoxicate answered 15/9, 2013 at 7:53 Comment(0)
H
1

If you do want to compile your native library for a newer version than your minSdkVersion, you can just configure Eclipse to change the error to a warning. This can be useful if you know that your Java code is NOT going to load the native library in older versions of Android. (Warning: If you don't guarantee that, then loading your native library on versions of Android older than what's specified in your APP_PLATFORM can fail and crash the app if there are unsatisfied dynamic library links - e.g. if your APP_PLATFORM is 9 and you use OpenSLES, this will fail if you try to use JNI on Android 2.2 or earlier. But as long as your Java side knows about this and ensures that loadLibrary is never called on older versions, then you're fine.)

You can change the Eclipse settings by following these steps, provided by a someone from Google (at this link) (but also, see my IMPORTANT note below):

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

IMPORTANT! What the Google guy didn't note is that you also need to use the "Move Up" button in the settings to move your new rule to the top because otherwise some other more generic rules overshadow it and it doesn't work.

Haw answered 7/1, 2014 at 15:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.