I installed nativescript according official website tutorial and run execute these
adb devices
found 1 device
tns platform add android
tns run android
I got 2 error in :compileF0DebugJavaWithJavac and searched for this issue. in most cases
this two line of code solved the problem but in my issue not worked
update nativescript then
tns platform remove android
tns platform add android
yes, I find out the most reason of this problem in out of date nativescript but my NS version is the latest version (3.1.3).
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.native",
"tns-android": {
"version": "3.1.1"
}
},
"dependencies": {
"@angular/animations": "~4.2.0",
"@angular/common": "~4.2.0",
"@angular/compiler": "~4.2.0",
"@angular/core": "~4.2.0",
"@angular/forms": "~4.2.0",
"@angular/http": "~4.2.0",
"@angular/platform-browser": "~4.2.0",
"@angular/router": "~4.2.0",
"nativescript-angular": "~4.2.0",
"nativescript-theme-core": "~1.0.2",
"reflect-metadata": "~0.1.8",
"rxjs": "~5.4.2",
"tns-core-modules": "^3.2.0-2017-8-25-6",
"zone.js": "~0.8.2"
},
"devDependencies": {
"babel-traverse": "6.4.5",
"babel-types": "6.4.5",
"babylon": "6.4.5",
"lazy": "1.0.11",
"nativescript-dev-typescript": "~0.5.0",
"typescript": "~2.4.2"
}
}
Total time: 15.402 secs
Project successfully prepared (Android)
Building project...
> Configuring > 0/3 projects > root project
:config phase: createDefaultIncludeFiles
+found plugins: tns-core-modules-widgets
+ creating include.gradle file for C:\Users\mtg13\native\platforms\android\configurations\tns-core-modules-widgets
Renaming plugin directory to flavor name: C:\Users\mtg13\native\platforms\android\src\tns-core-modules-widgets -> C:\Users\mtg13\native\platforms\android\src\F0
:config phase: createPluginsConfigFile
Creating product flavors include.gradle file in C:\Users\mtg13\native\platforms\android/configurations folder...
:config phase: pluginExtend
+applying configuration from: C:\Users\mtg13\native\platforms\android\configurations\include.gradle
+applying configuration from: C:\Users\mtg13\native\platforms\android\configurations\tns-core-modules-widgets\include.gradle
> Configuring > 0/3 projects > root project
:config phase: addAarDependencies
+adding dependency: C:\Users\mtg13\native\platforms\android\libs\aar\widgets-release.aar
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
Incremental java compilation is an incubating feature.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_5copqo3elewwtp8oq5ucinf6b.run(C:\Users\mtg13\native\platforms\android\build-tools\android-static-binding-generator\build.gradle:126)
:preBuild UP-TO-DATE
:preF0DebugBuild UP-TO-DATE
:checkF0DebugManifest
:preF0ReleaseBuild UP-TO-DATE
:prepareComAndroidSupportAnimatedVectorDrawable2531Library
:prepareComAndroidSupportAppcompatV72531Library
:prepareComAndroidSupportDesign2531Library
:prepareComAndroidSupportRecyclerviewV72531Library
:prepareComAndroidSupportSupportCompat2531Library
:prepareComAndroidSupportSupportCoreUi2531Library
:prepareComAndroidSupportSupportCoreUtils2531Library
:prepareComAndroidSupportSupportFragment2531Library
:prepareComAndroidSupportSupportMediaCompat2531Library
:prepareComAndroidSupportSupportV42531Library
:prepareComAndroidSupportSupportVectorDrawable2531Library
:prepareComAndroidSupportTransition2531Library
:prepareNativeRuntimeUnspecifiedLibrary
:prepareWidgetsReleaseLibrary
:prepareF0DebugDependencies
:compileF0DebugAidl
:compileF0DebugRenderscript
:generateF0DebugBuildConfig
:cleanLocalAarFiles
:ensureMetadataOutDir
:collectAllJars
:setProperties
:generateTypescriptDefinitions SKIPPED
:copyTypings SKIPPED
:asbg:generateInterfaceNamesList
:asbg:traverseJsFiles
:asbg:runAstParser
Running full build
finished with reading lines with js files
:asbg:generateBindings
:generateF0DebugResValues
:generateF0DebugResources
:mergeF0DebugResources
:processF0DebugManifest
:processF0DebugResources
:generateF0DebugSources
:incrementalF0DebugJavaCompilationSafeguard
:compileF0DebugJavaWithJavac
C:\Users\mtg13\native\platforms\android\build\generated\source\r\F0\debug\org\nativescript\native\R.java:8: error: <identifier> expected
package org.nativescript.native;
^
C:\Users\mtg13\native\platforms\android\build\generated\source\buildConfig\F0\debug\org\nativescript\native\BuildConfig.java:4: error: <identifier> expected
package org.nativescript.native;
^
2 errors
:compileF0DebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileF0DebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 34.541 secs
Unable to apply changes on device: ce6a8d62. Error is: Command gradlew.bat failed with exit code 1.
Executing after-watch hook from C:\Users\mtg13\native\hooks\after-watch\nativescript-dev-typescript.js
Hey @ProMasoud what are the reproduction steps?
@ProMasoud your app is called native and this causes some kind of an issue. In order for you to continue, please try running tns create <app_name> with an <app_name> different from "native".
We'll investigate further.
_Edit_
native is a java keyword and can't be used in package names.
According to the Java Specification, you cannot use reserved keywords in identifiers. And the package names are essentially such. - http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8
An identifier cannot have the same spelling (Unicode character sequence) as a keyword (搂3.9), boolean literal (搂3.10.3), or the null literal (搂3.10.7), or a compile-time error occurs.
Two identifiers are the same only if they are identical, that is, have the same Unicode character for each letter or digit. Identifiers that have the same external appearance may yet be different.
Following is the list of all reserved keywords:
http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.9
abstract continue for new switch
assert default if package synchronized
boolean do goto private this
break double implements protected throw
byte else import public throws
case enum instanceof return transient
catch extends int short try
char final interface static void
class finally long strictfp volatile
const float native super while
Meaning the error you are seeing is not a bug in the runtime particularly, we could think of a way to restrict these being used, but that could mean potentially slow A) project creation time or B) project build time.
Most helpful comment
According to the Java Specification, you cannot use reserved keywords in identifiers. And the package names are essentially such. - http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8
Following is the list of all reserved keywords:
http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.9
Meaning the error you are seeing is not a bug in the runtime particularly, we could think of a way to restrict these being used, but that could mean potentially slow A) project creation time or B) project build time.