NativeScript / NativeScript

⚡ Empowering JavaScript with native platform APIs. ✨ Best of all worlds (TypeScript, Swift, Objective C, Kotlin, Java, Dart). Use what you love ❤️ Angular, Capacitor, Ionic, React, Solid, Svelte, Vue with: iOS (UIKit, SwiftUI), Android (View, Jetpack Compose), Dart (Flutter) and you name it compatible.
https://nativescript.org
MIT License
24.26k stars 1.64k forks source link

Need Help - Error during Gradle build #6229

Closed rsevil-origin closed 6 years ago

rsevil-origin commented 6 years ago

I’m facing an issue while trying to build a project with a thirdparty private plugin.

When I run the command “tns run android” the build starts, it prepares all plugins, then builds the needed aar packages, executes after-prepare hooks, and then starts the gradle process, ir goes througth 50% and then throws many error complaining about illegal characters on generated java sources pointing to the lines and the file that’s causing the problem. It’s an encoding problem because with notepad++ I viewed that the file that is causing problems is being ANSI encoded and the rest of java source files are being encoded in UTF-8.

How can I change the encoding of that java source before it’s sent to the java compiler?

This is the output tns run android:

PS D:\WorkGit\keetup\ba-mascotas-mobile> tns run android
Skipping node_modules folder! Use the syncAllFiles option to sync files from this folder.
Searching for devices…
Executing before-liveSync hook from D:\WorkGit\keetup\ba-mascotas-mobile\hooks\before-liveSync\nativescript-angular-sync.js
Executing before-watch hook from D:\WorkGit\keetup\ba-mascotas-mobile\hooks\before-watch\nativescript-dev-sass.js
Found peer node-sass
Executing before-watch hook from D:\WorkGit\keetup\ba-mascotas-mobile\hooks\before-watch\nativescript-dev-typescript.js
Found peer TypeScript 2.4.2
18:43:38 - Compilation complete. Watching for file changes.

Executing before-prepare hook from D:\WorkGit\keetup\ba-mascotas-mobile\hooks\before-prepare\nativescript-dev-sass.js
Executing before-prepare hook from D:\WorkGit\keetup\ba-mascotas-mobile\hooks\before-prepare\nativescript-dev-typescript.js
Hook skipped because either bundling or livesync is in progress.
Executing before-prepare hook from D:\WorkGit\keetup\ba-mascotas-mobile\hooks\before-prepare\nativescript-localize.js
Executing before-prepare hook from D:\WorkGit\keetup\ba-mascotas-mobile\hooks\before-prepare\nativescript-miba-login.js
Configure google Services Version
D:\WorkGit\keetup\ba-mascotas-mobile\node_modules\nativescript-miba-login\lib
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\build.gradle
Preparing project…
Executing before-prepareJSApp hook from D:\WorkGit\keetup\ba-mascotas-mobile\hooks\before-prepareJSApp\nativescript-dev-webpack.js
Successfully prepared plugin nativescript-angular for android.
Successfully prepared plugin nativescript-bitmap-factory for android.
Successfully prepared plugin nativescript-calendar for android.
Successfully prepared plugin nativescript-camera for android.
Successfully prepared plugin nativescript-cardview for android.
Successfully prepared plugin nativescript-checkbox for android.
Successfully prepared plugin nativescript-geolocation for android.
Successfully prepared plugin nativescript-image-cache for android.
Successfully prepared plugin nativescript-imagepicker for android.
nativescript-iqkeyboardmanager is not supported for android.
Successfully prepared plugin nativescript-iqkeyboardmanager for android.
Successfully prepared plugin nativescript-localize for android.
Successfully prepared plugin nativescript-miba-login for android.
Successfully prepared plugin nativescript-permissions for android.
Successfully prepared plugin nativescript-phone for android.
Successfully prepared plugin nativescript-theme-core for android.
Successfully prepared plugin nativescript-toast for android.
Successfully prepared plugin nativescript-ui-listview for android.
Successfully prepared plugin nativescript-ui-sidedrawer for android.
Successfully prepared plugin tns-core-modules for android.
Successfully prepared plugin nativescript-intl for android.
Successfully prepared plugin nativescript-ui-core for android.
Successfully prepared plugin tns-core-modules-widgets for android.
Built aar for nativescript-camera
Built aar for nativescript-geolocation
Built aar for nativescript-imagepicker
Built aar for nativescript-miba-login
Project successfully prepared (Android)
Executing after-prepare hook from D:\WorkGit\keetup\ba-mascotas-mobile\hooks\after-prepare\nativescript-dev-sass.js
Executing after-prepare hook from D:\WorkGit\keetup\ba-mascotas-mobile\hooks\after-prepare\nativescript-dev-webpack.js
Executing after-prepare hook from D:\WorkGit\keetup\ba-mascotas-mobile\hooks\after-prepare\nativescript-miba-login.js
Copying google Services Configuration
Copy D:\WorkGit\keetup\ba-mascotas-mobile\app\App_Resources\Android\google-services.json to D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\google-services.json.
Building project…
Gradle build…
+ setting applicationId
+ applying user-defined configuration from D:\WorkGit\keetup\ba-mascotas-mobile\app\App_Resources\Android\app.gradle
Applying settings from D:\WorkGit\keetup\ba-mascotas-mobile\app\App_Resources\Android\settings.json
+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector
+ adding aar plugin dependency: D:\WorkGit\keetup\ba-mascotas-mobile\node_modules\nativescript-calendar\platforms\android\nativescript_calendar.aar
+ adding aar plugin dependency: D:\WorkGit\keetup\ba-mascotas-mobile\node_modules\nativescript-camera\platforms\android\nativescript_camera.aar
+ adding aar plugin dependency: D:\WorkGit\keetup\ba-mascotas-mobile\node_modules\nativescript-geolocation\platforms\android\nativescript_geolocation.aar
+ adding aar plugin dependency: D:\WorkGit\keetup\ba-mascotas-mobile\node_modules\nativescript-imagepicker\platforms\android\nativescript_imagepicker.aar
+ adding aar plugin dependency: D:\WorkGit\keetup\ba-mascotas-mobile\node_modules\nativescript-miba-login\platforms\android\baidsdk.aar
+ adding aar plugin dependency: D:\WorkGit\keetup\ba-mascotas-mobile\node_modules\nativescript-miba-login\platforms\android\callejerogcba.aar
+ adding aar plugin dependency: D:\WorkGit\keetup\ba-mascotas-mobile\node_modules\nativescript-miba-login\platforms\android\nativescript_miba_login.aar
+ adding aar plugin dependency: D:\WorkGit\keetup\ba-mascotas-mobile\node_modules\nativescript-phone\platforms\android\nativescript_phone.aar
+ adding aar plugin dependency: D:\WorkGit\keetup\ba-mascotas-mobile\node_modules\nativescript-ui-listview\platforms\android\TNSListView-release.aar
+ adding aar plugin dependency: D:\WorkGit\keetup\ba-mascotas-mobile\node_modules\nativescript-ui-sidedrawer\platforms\android\TNSSideDrawer-release.aar
+ adding aar plugin dependency: D:\WorkGit\keetup\ba-mascotas-mobile\node_modules\nativescript-ui-core\platforms\android\TNSCore-release.aar
+ adding aar plugin dependency: D:\WorkGit\keetup\ba-mascotas-mobile\node_modules\tns-core-modules-widgets\platforms\android\widgets-release.aar
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:3731: error: illegal character: ‘\u00b1’
public static final int recupera_contrase├▒a_padding_left=0x7f07011c;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:3731: error: expected
public static final int recupera_contrase├▒a_padding_left=0x7f07011c;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4306: error: illegal character: ‘\u00b1’
public static final int recupera_contrase├▒a_enviar_button_id=0x7f0900e2;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4306: error: expected
public static final int recupera_contrase├▒a_enviar_button_id=0x7f0900e2;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4307: error: illegal character: ‘\u00b1’
public static final int recupera_contrase├▒a_error_message_id=0x7f0900e3;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4307: error: expected
public static final int recupera_contrase├▒a_error_message_id=0x7f0900e3;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4308: error: illegal character: ‘\u00b1’
public static final int recupera_contrase├▒a_ingresa_email_id=0x7f0900e4;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4308: error: expected
public static final int recupera_contrase├▒a_ingresa_email_id=0x7f0900e4;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4566: error: illegal character: ‘\u2018’
public static final int ACTIVITY_CREATE_ACCOUNT_CONTRASEÑA=0x7f0e0001;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4566: error: expected
public static final int ACTIVITY_CREATE_ACCOUNT_CONTRASEÑA=0x7f0e0001;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4569: error: illegal character: ‘\u2018’
public static final int ACTIVITY_CREATE_ACCOUNT_RPETIR_CONTRASEÑA=0x7f0e0004;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4569: error: expected
public static final int ACTIVITY_CREATE_ACCOUNT_RPETIR_CONTRASEÑA=0x7f0e0004;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4627: error: illegal character: ‘\u2018’
public static final int OLVIDASTE_CONTRASEÑA=0x7f0e003e;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4627: error: expected
public static final int OLVIDASTE_CONTRASEÑA=0x7f0e003e;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4628: error: illegal character: ‘\u2018’
public static final int OLVIDASTE_CONTRASEÑA_UNDERLINE=0x7f0e003f;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4628: error: expected
public static final int OLVIDASTE_CONTRASEÑA_UNDERLINE=0x7f0e003f;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4634: error: illegal character: ‘\u2018’
public static final int RECUPERA_TU_CONTRASEÑA=0x7f0e0045;
^
D:\WorkGit\keetup\ba-mascotas-mobile\platforms\android\app\build\generated\source\r\debug\ar\gob\buenosaires\mascotas\R.java:4634: error: expected
public static final int RECUPERA_TU_CONTRASEÑA=0x7f0e0045;
^
18 errors

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ‘:app:compileDebugJavaWithJavac’.
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. Run with --scan to get full insights.s.

Get more help at https://help.gradle.org

BUILD FAILED in 53s
NickIliev commented 6 years ago

@rsevil-origin try the solutions posted in this SO thread.

Closing the issue as it is not related to NativeScript.

rsevil-origin commented 6 years ago

@NickIliev I know that this is not a NativeScript bug, I already tried setting in my app.gradle file, under android, compileOptions.encoding "UTF-8" or other values but I keep getting the same errors, because the java source is mixed, all sources are UTF-8 encoded but there is one that is being ANSI encoded.

I'm looking for help because I don't know what can I do to fix this issue.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.