How to run the Kotlin/Native win32 sample - windows

I'm trying to run Kotlin/Native v0.3 win32 sample by following the blog at https://blog.jetbrains.com/kotlin/2017/06/kotlinnative-v0-3-is-out/
I downloaded the x86-64 Windows zip file as instructed at the end of the blog.
I run kotlin-native-windows-0.3\samples>gradlew.bat and it
downloaded something and said 'BUILD SUCCESSFUL'. (I'm not sure if
this step is necessary)
2.1 But If I run kotlin-native-windows-0.3\samples>gradlew build
in this folder, I got some failures:
C:\Users\OO\Documents\kotlin-native-windows-0.3\samples>gradlew build
:concurrent:assemble UP-TO-DATE
:concurrent:check UP-TO-DATE
:concurrent:downloadKonanCompiler
:concurrent:genMessageChannelInteropStubs UP-TO-DATE
:concurrent:compileCpp FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':concurrent:compileCpp'.
A problem occurred starting process 'command './buildCpp.sh''
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Then I run kotlin-native-windows-0.3\samples\win32>build.bat and I
got another error.
C:\Users\OO\Documents\kotlin-native-windows-0.3\samples\win32>build.bat
exception: java.lang.IllegalStateException: Could not find "win32" in [C:\Users\OO\Documents\kotlin-native-windows-0.3\samples\win32, C:\Users\OO\.konan\klib, C:\Users\OO\DOCUME~1\KOTLIN~1.3\bin\..\klib].
at org.jetbrains.kotlin.backend.konan.library.KonanLibrarySearchPathResolver.resolve(SearchPathResolver.kt:71)
at org.jetbrains.kotlin.backend.konan.KonanConfig$librariesFound$2.invoke(KonanConfig.kt:70)
at org.jetbrains.kotlin.backend.konan.KonanConfig$librariesFound$2.invoke(KonanConfig.kt:34)
at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130)
at org.jetbrains.kotlin.backend.konan.KonanConfig.getLibrariesFound(KonanConfig.kt)
at org.jetbrains.kotlin.backend.konan.KonanConfig.access$getLibrariesFound$p(KonanConfig.kt:34)
at org.jetbrains.kotlin.backend.konan.KonanConfig$libraries$2.invoke(KonanConfig.kt:77)
at org.jetbrains.kotlin.backend.konan.KonanConfig$libraries$2.invoke(KonanConfig.kt:34)
at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130)
at org.jetbrains.kotlin.backend.konan.KonanConfig.getLibraries$backend_native_compiler(KonanConfig.kt)
at org.jetbrains.kotlin.backend.konan.KonanConfig.loadLibMetadata(KonanConfig.kt:90)
at org.jetbrains.kotlin.backend.konan.KonanConfig.<init>(KonanConfig.kt:80)
at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:66)
at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:56)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:93)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:46)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:90)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:68)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:34)
at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:160)
at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMain(CLITool.kt:151)
at org.jetbrains.kotlin.cli.bc.K2Native$Companion$main$1.invoke(K2Native.kt:169)
at org.jetbrains.kotlin.cli.bc.K2Native$Companion$main$1.invoke(K2Native.kt:166)
at org.jetbrains.kotlin.backend.konan.util.UtilKt.profileIf(util.kt:33)
at org.jetbrains.kotlin.backend.konan.util.UtilKt.profile(util.kt:28)
at org.jetbrains.kotlin.cli.bc.K2Native$Companion.main(K2Native.kt:168)
at org.jetbrains.kotlin.cli.bc.K2NativeKt.main(K2Native.kt:174)
at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:46)
I'm very new to Kotlin or Gradle world, I don't know if this is the way to compile the samples.
What additional packages should I install?

It can be easily solved by canceled the comments "rem call ..." in "build.bat"

Related

Deploying KotlinJs React web app to Heroku, error extracting tar content of undefined failed

I have the following setup. Kotlin Multiplatform project with a Web App and Shared module. I also have included a build of a library that I had to modify myself as it wasn't working properly.
When trying to deploy to Heroku with these steps I get the following error
> Task :common:root:jsPackageJson
> Task :web-app:packageJson
> Task :web-app:testPackageJson
> Task :rootPackageJson
> Task :kotlinNpmInstall
warning workspace-aggregator-7524aa80-df12-48c3-95c5-de7144004dc0 > firebase-kotlin-sdk-firebase-app > webpack-dev-server > sockjs > uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
warning workspace-aggregator-7524aa80-df12-48c3-95c5-de7144004dc0 > firebase-kotlin-sdk-firebase-app > webpack-dev-server > url > querystring#0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
error https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001269.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, stat '/app/.cache/yarn/v6/npm-caniuse-lite-1.0.30001269-3a71bee03df627364418f9fd31adfc7aa1cc2d56-integrity/node_modules/caniuse-lite/LICENSE'"
> Task :firebase-kotlin-sdk:kotlinNpmInstall
error https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001269.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, stat '/app/.cache/yarn/v6/npm-caniuse-lite-1.0.30001269-3a71bee03df627364418f9fd31adfc7aa1cc2d56-integrity/node_modules/caniuse-lite/data/features/getcomputedstyle.js'"
> Task :firebase-kotlin-sdk:kotlinNpmInstall FAILED
> Task :kotlinNpmInstall FAILED
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':kotlinNpmInstall'.
> Process 'Resolving NPM dependencies using yarn' returns 1
yarn install v1.22.10
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':firebase-kotlin-sdk:kotlinNpmInstall'.
> Process 'Resolving NPM dependencies using yarn' returns 1
yarn install v1.22.10
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
* 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.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 5m 20s
18 actionable tasks: 18 executed
! ERROR: Failed to run Gradle!
We're sorry this build is failing. If you can't find the issue in application
code, please submit a ticket so we can help: https://help.heroku.com
You can also try reverting to the previous version of the buildpack by running:
$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-gradle#previous-version
Thanks,
Heroku
! Push rejected, failed to compile Gradle app.
! Push failed
Tried running kotlinNpmInstall locally on both the library and the whole project and it works properly, with no failures.
While I do not know the exact cause, it seems that multiple yarn process are spawned that corrupt each other's packages.
This can be solved with the mutex option.
To add yarn options to a kotlin/js project you can add a .yarnrc file to the root of your project.
My .yarnrc's content:
--install.mutex network
This makes yarn use a predefined port on the network for its mutex.

Execution failed for task ':app:processDebugResources'.1

I clearly have no clue why it shows this error. All solutions are appreciated.
What went wrong:
Execution failed for task ':app:processDebugResources'.
Android resource linking failed
Output: W/ziparchive( 9548): Unable to open 'C:\Users\admin\AppData\Local\Android\sdk\platforms\android-28\android.jar': No such file or directory
error: failed to open APK: I/O error.
Command: C:\Users\admin.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\c8dfbdcc79a1dd8c0cb75349d60f6c77\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
C:\Users\admin\AppData\Local\Android\sdk\platforms\android-28\android.jar\
--manifest\
C:\Users\gaurav\tutorial\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
-o\
C:\Users\gaurav\tutorial\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
#C:\Users\gaurav\tutorial\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
C:\Users\gaurav\tutorial\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--custom-package\
com.example.tutorial\
-0\
apk\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
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.
Get more help at https://help.gradle.org
BUILD FAILED in 22s
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://flutter.dev/docs/development/androidx-migration for more information on the problem and how to fix it.
Finished with error: Gradle task assembleDebug failed with exit code 1
Update you sdk version to 28. Edit the file build.gradle and change property compileSdkVersion up to 28.

How to fix a diagnostic error in flutter?

When I run the application gradle is failing to build
Compiler message:
file:///C:/Users/Wellick/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sticky_header-0.3.4/lib/src/widgets/sticky_header_layout_builder.dart:147:16:
Error: The argument type 'String' can't be assigned to the parameter
type 'DiagnosticsNode'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart'
('file:///C:/Users/Wellick/Documents/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to
'DiagnosticsNode'.
context: context);
^ Compiler failed on C:\Users\Wellick\Desktop\flutter\rapidinho-master\lib\main.dart
FAILURE: Build failed with an exception.
Where: Script 'C:\Users\Wellick\Documents\flutter\packages\flutter_tools\gradle\flutter.gradle'
line: 665
What went wrong: Execution failed for task ':app:compileflutterBuildDebugArm'.
Process 'command 'C:\Users\Wellick\Documents\flutter\bin\flutter.bat'' finished with
non-zero exit value 1
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.
Get more help at https://help.gradle.org
BUILD FAILED in 24s Finished with error: Gradle task assembleDebug
failed with exit code 1
It seems that this issue was due to the previous version 0.3.4 to be exact, the issue was reported in GitHub and the fix is to upgrade the version to 0.4.0. Currently, the latest version 0.5.0 is more stable than the previous versions.

NativeScript UI Autocomplete don't compiled

In my nativescript app, I have a problem about using nativescript ui autocomplete. I compile my mobile application to android apps. It has an error as below
<======-------> 50% CONFIGURING [3s]
<====---------> 35% EXECUTING [13s]
<======-------> 51% EXECUTING [20s]
Exception in thread "main" java.lang.ClassNotFoundException: Class: com.telerik.widget.autocomplete.ShowSuggestionListListener
at org.nativescript.staticbindinggenerator.Generator.getClass(Generator.java:776)
at org.nativescript.staticbindinggenerator.Generator.collectInterfaceMethods(Generator.java:703)
at org.nativescript.staticbindinggenerator.Generator.getPublicApi(Generator.java:227)und 0 errors. Watching for file changes.
at org.nativescript.staticbindinggenerator.Generator.writeBinding(Generator.java:342)
at org.nativescript.staticbindinggenerator.Generator.generateBinding(Generator.java:133)
at org.nativescript.staticbindinggenerator.Generator.processRows(Generator.java:172)
at org.nativescript.staticbindinggenerator.Generator.generateBindings(Generator.java:90)
at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:66)
at org.nativescript.staticbindinggenerator.Main.main(Main.java:47)
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:runSbg'.
Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 1
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.
Get more help at https://help.gradle.org
BUILD FAILED in 25s
10:34:24 - Found 0 errors. Watching for file changes.
Unable to apply changes on device: 192.168.80.101:5555. Error is: Command ./gradlew failed with exit code 1.
Executing after-watch hook from /home/andre/nativescript/TigaRoda/hooks/after-watch/nativescript-dev-typescript.js
Stopping tsc watch
Executing after-watch hook from /home/andre/nativescript/TigaRoda/hooks/after-watch/nativescript-dev-webpack.js
Stopping webpack watch
delete node_modules, platforms, hooks folders and package-lock.json file
run
npm i
rebuild the project ->
tns run android
or
tns build android

phongap's error:- Execution failed for task ':transformClassesWithDexForDebug'

when i am trying to build my phonegap app at that time i am getting this error.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/iid/zzc;
* 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: 3.261 secs
is there anything missing? what is wrong? thanks in advance
below, solution works for me.
i checked the 'project.properties' file in android's folder.
target=android-25
android.library.reference.1=CordovaLib
cordova.system.library.1=com.google.android.gms:play-services-maps:+
cordova.system.library.2=com.google.android.gms:play-services-location:+
cordova.gradle.include.1=phonegap-plugin-push/app-push.gradle
cordova.system.library.3=com.android.support:support-v13:23+
cordova.system.library.4=com.google.android.gms:play-services-gcm:10.2+
cordova.system.library.5=me.leolin:ShortcutBadger:1.1.14#aar
cordova.gradle.include.2=card.io.cordova.mobilesdk/app-build.gradle
cordova.gradle.include.3=com.paypal.cordova.mobilesdk/app-build.gradle
cordova.system.library.6=com.google.android.gms:play-services- location:10.2+
cordova.system.library.7=com.razorpay:checkout:1.3.0
cordova.system.library.8=com.android.support:support-v4:25.+
cordova.system.library.9=com.android.support:appcompat-v7:25.+
cordova.system.library.10=com.google.android.gms:play-services-maps:+
cordova.system.library.11=com.google.android.gms:play-services-location:+
i just removed last two lines because those lines seems duplicated. and it works for me

Resources