Android Runtime doesn't play nice with productFlavors
@vmutafov arbeitet bereits daran.
Seit 19.5.2020.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
Environment
- CLI: 6.5.0
- Cross-platform modules: 6.5.1
- Android Runtime: 6.5.0
Describe the bug
When adding productFlavors to your build.gradle, something odd seems to happen in the metadata generation and some classes aren't available to NativeScript anymore.
To Reproduce
- Create a sample project where you call
console.log(com.tns.NativeScriptApplication.getInstance());from Typescript - Test the app, it should work and return the application instance
- Now add productFlavors (they don't even have to include any specific settings) to your project, like this:
android {
defaultConfig {
minSdkVersion 17
generatedDensities = []
}
flavorDimensions "api"
productFlavors {
minApi21 {
dimension "api"
versionNameSuffix "-minApi21"
}
minApi17 {
dimension "api"
versionNameSuffix "-minApi17"
}
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
android.variantFilter { variant ->
// Don't build minApi21 apk for debug.
if(variant.buildType.name.endsWith('debug') && variant.name.contains("minApi21")) {
variant.setIgnore(true);
}
}
- Remove your platforms folder
- Run the app again, now the
com.tns.NativeScriptApplication.getInstance()will result in aCannot read property 'getInstance' of undefinederror.
Expected behavior
Behavior should be the same as without productFlavors.
Sample project
https://github.com/jerbob92/nativescript-productflavor-bug
- Vorherrschende Sprache
- C++
- Sterne
- 563
- Forks
- 144
- Ø Merge
- 10 Std. 46 Min.
- Gemergte PRs (30 T.)
- 14
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus NativeScript/android
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 38/100
NativeScript/android#2039 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
NativeScript/android#2024 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 20/100
NativeScript/android#2020 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 42/100
NativeScript/android#2019 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
NativeScript/android#1986 ·
Alle Issues in NativeScript/android
Ähnliche Issues
-
ai_reviewed
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
ydb-platform/ydb#53869 · 3 Kommentare ·
-
bug cert blocker needs triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
project-chip/connectedhomeip#74373 ·
-
[request] tracy/0.14.1 Offenupstream update
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
conan-io/conan-center-index#31035 ·
-
Bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
documentation
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
vllm-project/vllm-ascend#17329 ·