Here are the specific properties you can configure for the Android output:
- Declaring Android libraries
- SDK versions
- Custom Android Manifest
- Android External projects
- Android template path
Declaring Android libraries¶
Please refer to the dedicated documentation to learn how to add external Android libraries.
Gradle remote dependencies and remote repositories can be declared in the
<specific><android> tag of
<gradleproperties> tag to add a
<dependency> and/or a
<repository> to your Android project.
For example, to declare an Android remote dependency
com.example.android:app-magic:12.3 and an Android remote repository
<specific> <android> <gradleproperties> <dependency groupname="com.example.android" name="app-magic" version="12.3"/> <repository type="maven" url="https://repo.example.com/maven2" /> </gradleproperties> </android> </specific>
It may happen that you do not want your application to support all Android OS version. This
can be configured using the
attributes of the URS.
The attributes will be explained further in the documentation but refer to the Android official
to have all the information.
<urs> [...] <specific> <android minSdkVersion="" targetSdkVersion="" maxSdkVersion="" > </android> </specific> </urs>
Min SDK Version
Specifies the minimum API Level on which the application is able to run.
NeoMAD supports API Level 19 or greater for
Max SDK Version
Specifies the maximum API Level on which the application is able to run. By default, this value is not filled.
Target SDK Version
Specifies the API Level on which the application is designed to run. In some cases, this allows the application to use manifest elements or behaviors defined in the target API Level, rather than being restricted to using only those defined for the minimum API Level.
NeoMAD supports API Level 24 or greater for
|Platform Version||API Level||VERSION_CODE|
Android 7.1, 7.1.1
|Android 6.0||23||M (MarshMallow)|
This is a partial part of the Android API levels. To have a complete vision please refers to the Android official documentation https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels.
Custom Android Manifest¶
Developers who want to add specific content to the manifest can use a template to create their own manifest files.
This template is located at:
The content of this template is the same as the default one used by NeoMAD.
If the default Android manifest provided by NeoMAD is not sufficient for your application or if you need to activate options for a specific target, you can create your own manifest.
Copy/paste the template wherever you want in the project and add your specific content.
Then, tell NeoMAD to use your manifest file by using the
<androidmanifest> tag in the URS file.
You may notice some words beginning with “$”, like “$VERSION”. These tags are used by NeoMAD to automatically substitute data picked from the URS file. This is why your manifest file must be based on the template provided by NeoMAD. All the options declared in the manifest template using these tags MUST be kept and MUST NOT be overridden.
<urs> [...] <androidmanifest path="path/to/MyAndroidManifest.xml"> </urs>
Android External projects¶
The specific code may rely on an entire external Android project to work. To import such a project in the
specific code, declare it using the tag
<specific> <android> <!-- Android third party reference project --> <project path="lib/my-third-party-project" /> </android> </specific>
Android projects should respect the following file tree:
Android template path¶
NeoMAD is based on a template folder to generate the Android Studio project when building for an Android target. This template folder is located at:
For very specific need when specific code is used, you may need to customize that templates (to declare a particular dependency in the build.gradle for example). In order to do that, just copy the NeoMAD template directory in your project and complete it with your specific needs. Then the new template directory must be referenced in the URS file to replace the NeoMAD template directory at buid time.
<specific> <android templatePath="path-to-my-custom-template-directory"> </android> </specific>
You may notice some words beginning with “$” (like “$VERSION”) and some files with extension
These tags are used by NeoMAD to automatically substitute data picked from the URS file. Be sure to keep
these tags when completing the templates to be sure that the project still build.
As specified in the Android documentation (https://developer.android.com/studio/build/multidex), when your app and the libraries it references exceed 65,536 methods, you encounter a build error that indicates your app has reached the limit of the Android build architecture:
trouble writing output: Too many field references: 131000; max is 65536. You may try using --multi-dex option.
Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536
To avoid these errors, the “multidex” option must be activated in the URS file:
<specific> <android multiDexEnabled="true"> </android> </specific>
The application will build using the Android multidex library and this will fix the 65,536 methods limitation. Be aware that applications that use multidex may encounter some limitations (see https://developer.android.com/studio/build/multidex). Before using multidex try to avoid the 64K limitation by reviewing your code, limiting the dependencies or optimizing the source code with proguard.