Closed mablejohn closed 6 years ago
i also have facing same problem.Please anyone solve this issue.
same problem in #19
to fix problem do that:
step 1:
replace file settings.gradle
in app/App_Resources
with:
import groovy.json.JsonSlurper
task replaceSettings {
description "Replaces configuration settings."
def jsonSlurper = new JsonSlurper()
def pathToSettingsJson
if (project.hasProperty("appResourcesPath")) {
pathToSettingsJson = "$project.appResourcesPath/Android/settings.json";
} else {
pathToSettingsJson = "$rootDir/../../app/App_Resources/Android/settings.json";
}
def settingsJsonFile = file(pathToSettingsJson);
def settingsResolvedPath = settingsJsonFile.getAbsolutePath();
if(settingsJsonFile.exists())
{
println "\t Applying settings from $settingsResolvedPath"
String settingsGradleTemplate = """android {
defaultConfig {
applicationId = "__appId__"
if (__minSdkVersion__) {
minSdkVersion = __minSdkVersion__
}
if (__targetSdkVersion__) {
targetSdkVersion = __targetSdkVersion__
}
manifestPlaceholders = [onesignal_app_id: "__onesignal_app_id__", onesignal_google_project_number: "REMOTE"]
}
}"""
def settingsJsonContent = settingsJsonFile.getText("UTF-8");
def settingsMap = jsonSlurper.parseText(settingsJsonContent);
for ( setting in settingsMap ) {
def placeholder = "__${setting.key}__";
def settingValue = setting.value;
if (settingValue == null) {
settingValue = false
}
settingsGradleTemplate = settingsGradleTemplate.replaceAll( placeholder, settingValue as String);
}
new File( "$rootDir/temp_setting.gradle" ).write( settingsGradleTemplate, 'UTF-8');
apply from: "$rootDir/temp_setting.gradle";
}
}
__onesignal_app_id__
with your OneSignal app idstep 2:
tns platform clean android
step 3:
tns run android
No such file (settings.gradle) in app/App_Resources
I updated NativeScript CLI Tooling and Android runtimes then the problem went away.
Environment information
√ Your ANDROID_HOME environment variable is set and points to correct directory.
√ Your adb from the Android SDK is correctly installed.
√ The Android SDK is installed.
√ A compatible Android SDK for compilation is found.
√ Javac is installed and is configured properly.
√ The Java Development Kit (JDK) is installed and is configured properly.
√ Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can
use the NativeScript cloud infrastructure.
No issues were detected.
√ Getting NativeScript components versions information...
√ Component nativescript has 4.0.0 version and is up to date.
√ Component tns-core-modules has 4.0.0 version and is up to date.
√ Component tns-android has 4.0.1 version and is up to date.
× Component tns-ios is not installed.
Hello,
I would like to create a Cross platform project using TNS.
I tried your tutorial and I ran few commands
And ended up with the following stack-trace.
Would you please tell me what I am doing wrong?
Thanks a lot. Mable John
The stack trace: