You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When specifying multiple flavors in the app.gradle and thus more than one APK gets generated during build, the CLI prints a warning More than one .apk found in ... directory. Using the last one produced from build.
So depending on Gradle's internal workings when doing a tns run android the APK that was built first is picked. Which may not be the right one in this case.
In addition, the CLI brings up a warning if the product flavors create APKs with different application identifiers. In my case, the flavors use applicationIdSuffixto append a .devsuffix for internal releases.
WARNING: The Application identifier is different from the one inside package.json file.
NativeScript CLI might not work properly.
Update the application identifier in package.json and app.gradle so that they match.
Maybe we need some other way of handling the idspecified in the package.json and potentially custom adjustments in the app.gradle
The same issue could also happen with multiple build configs / variants on iOS (e.g. specifiying variants in the build.xcconfig file)
With the improved support for flavors and the desire to streamline my CI as much as possible, I've found out this is still missing and also relevant (for myself). Would this fit on the roadmap at some point?
CLI: 4.2.3
Cross-platform modules: tns-core-modules 4.2.0
Runtime(s): tns-androd 4.2.0
I'm hammering out a rough workaround to deal with this, and it involves changing the last modified date of the desired apk in app.gradle. Hopefully, this partial solution can help inspire others in need.
applicationVariants.all { variant ->
// TODO: specify the flavor through the command-line or an environment variable.
if (variant.getFlavorName() == 'dev' ) {
variant.assemble.doLast {
println "Ensuring the selected flavor is chosen by the nativescript-cli: " + variant.getFlavorName()
variant.outputs.each { output ->
println output.outputFile
if (output.outputFile.setLastModified(new Date().getTime() + 600000) ) {
} else {
println "The apk was NOT modified!"
}
}
}
}
Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?
yes.
Tell us about the problem
When specifying multiple flavors in the
app.gradle
and thus more than one APK gets generated during build, the CLI prints a warningMore than one .apk found in ... directory. Using the last one produced from build.
So depending on Gradle's internal workings when doing a
tns run android
the APK that was built first is picked. Which may not be the right one in this case.nativescript-cli/lib/services/platform-service.ts
Line 800 in 8cd21b8
Would be great if the CLI would have an option to specify which flavor (or APK) to be used on
tns run
Which platform(s) does your issue occur on?
macOS, Android build
Please provide the following version numbers that your issue occurs with:
The text was updated successfully, but these errors were encountered: