I'm starting to learn the android NDK and I've instantly come up against a problem.
I'e built the tool chain (which took a LOT longer than I was expecting!!) and I've compiled the C++ code with no problems and now I'm trying to build the java code.
Instantly I come up against a problem. There is a file "main.xml"
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Hello World, DemoActivity" /> </LinearLayout>
and I get the following errors:
Description Resource Path Location Type error: Error: String types not allowed (at 'layout_height' with value 'match_parent'). main.xml /DemoActivity/res/layout line 2 Android AAPT Problem error: Error: String types not allowed (at 'layout_height' with value 'match_parent'). main.xml /DemoActivity/res/layout line 2 Android AAPT Problem error: Error: String types not allowed (at 'layout_width' with value 'match_parent'). main.xml /DemoActivity/res/layout line 2 Android AAPT Problem error: Error: String types not allowed (at 'layout_width' with value 'match_parent'). main.xml /DemoActivity/res/layout line 7 Android AAPT Problem error: Error: String types not allowed (at 'layout_width' with value 'match_parent'). main.xml /DemoActivity/res/layout line 7 Android AAPT Problem
So I can see the problem lies in the fact that these "match_parent" strings are in there. Anyone know how to fix this?
Android provides Native Development Kit (NDK) to support native development in C/C++, besides the Android Software Development Kit (Android SDK) which supports Java. [TODO] more. NDK is a complex and advanced topics.
With a project open, click Tools > SDK Manager. Click the SDK Tools tab. Select the Show Package Details checkbox. Select the NDK (Side by side) checkbox and the checkboxes below it that correspond to the NDK versions you want to install.
The Native Development Kit (NDK) is a set of tools that allows you to use C and C++ code with Android, and provides platform libraries you can use to manage native activities and access physical device components, such as sensors and touch input.
You can automatically install the required NDK and CMake using the Android Gradle Plugin 4.2. 0+ when the project is first created, provided their licenses are accepted beforehand. If you have read and agree to the terms of the license, you can use the following command to pre-accept the license in the script.
Check what API Level you are using.
FILL_PARENT
was renamed to MATCH_PARENT
in API Level 8 (Android 2.2).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With