on vs code, i have a folder called master on my desktop with 2 kotlin files, main.kt and foo.kt.
main.kt's code
import master
fun main() {
println("hello")
foo()
}
foo.kt's code:
import master
fun foo(){
println("code from foo")
}
however, when i run kotlinc hello.kt -d hello.jar on the terminal of vs code, it says error: unresolved reference: foo
how can i resolve this? am i naming the packages wrong? I just want to run a very light kotlin package.
What am I missing in build.gradle.kts file?
import com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask
plugins {id("com.netflix.dgs.codegen") version "5.4.0"}
dependencies {implementation("com.netflix.graphql.dgs.codegen:graphql-dgs-codegen-gradle:5.4.0")}
and getting error when calling GenerateJavaTask
tasks.withType<com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask> {
generateClient = true
packageName = "com.house.api.generated"
}
error (which are pointing to above lines):
Unresolved reference: GenerateJavaTask
Unresolved reference: GenerateJavaTask
Type mismatch: inferred type is () -> Unit but Class<TypeVariable(S)!> was expected
Unresolved reference: generateClient
Unresolved reference: packageName
% npx react-native run-android Starting JS server... Building and
installing the app on the device (cd android && ./gradlew
installDebug)...
Configure project :react-native-reanimated WARNING: The specified Android SDK Build Tools version (28.0.2) is ignored, as it is below
the minimum supported version (29.0.2) for Android Gradle Plugin
4.1.0. Android SDK Build Tools 29.0.2 will be used. To suppress this warning, remove "buildToolsVersion '28.0.2'" from your build.gradle
file, as each version of the Android Gradle Plugin now has a default
version of the build tools. Warning: Mapping new ns
http://schemas.android.com/repository/android/common/02 to old ns
http://schemas.android.com/repository/android/common/01 Warning:
Mapping new ns
http://schemas.android.com/repository/android/generic/02 to old ns
http://schemas.android.com/repository/android/generic/01 Warning:
Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02
to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns
http://schemas.android.com/sdk/android/repo/repository2/02 to old ns
http://schemas.android.com/sdk/android/repo/repository2/01 Warning:
Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02
to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Configure project :react-native-linear-gradient WARNING: Configuration 'provided' is obsolete and has been replaced with
'compileOnly'. It will be removed in version 5.0 of the Android Gradle
plugin. For more information, see
http://d.android.com/r/tools/update-dependency-configurations.html.
Configure project :react-native-orientation WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and
'api'. It will be removed in version 5.0 of the Android Gradle plugin.
For more information, see
http://d.android.com/r/tools/update-dependency-configurations.html.
Configure project :app WARNING: The option 'android.useDeprecatedNdk' is deprecated. The current default is
'false'. It has been removed from the current version of the Android
Gradle plugin. NdkCompile is no longer supported WARNING:
Configuration 'compile' is obsolete and has been replaced with
'implementation' and 'api'. It will be removed in version 5.0 of the
Android Gradle plugin. For more information, see
http://d.android.com/r/tools/update-dependency-configurations.html.
WARNING: API 'variant.getMergeResources()' is obsolete and has been
replaced with 'variant.getMergeResourcesProvider()'. It will be
removed in version 5.0 of the Android Gradle plugin. For more
information, see
https://d.android.com/r/tools/task-configuration-avoidance. To
determine what is calling variant.getMergeResources(), use
-Pandroid.debug.obsoleteApi=true on the command line to display more information. WARNING: API 'variant.getPackageApplication()' is
obsolete and has been replaced with
'variant.getPackageApplicationProvider()'. It will be removed in
version 5.0 of the Android Gradle plugin. For more information, see
https://d.android.com/r/tools/task-configuration-avoidance. To
determine what is calling variant.getPackageApplication(), use
-Pandroid.debug.obsoleteApi=true on the command line to display more information. WARNING: API 'variant.getMergeAssets()' is obsolete and
has been replaced with 'variant.getMergeAssetsProvider()'. It will be
removed in version 5.0 of the Android Gradle plugin. For more
information, see
https://d.android.com/r/tools/task-configuration-avoidance. To
determine what is calling variant.getMergeAssets(), use
-Pandroid.debug.obsoleteApi=true on the command line to display more information.
Task :app:compileDebugJavaWithJavac FAILED /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:9:
Error: Packagecom.reactnativecommunity.webview does not exist import
com.reactnativecommunity.webview.RNCWebViewPackage;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:18:
Error: Packagecom.beefe.picker does not exist import
com.beefe.picker.PickerViewPackage;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:28:
Error: Packagecom.reactnativenavigation does not exist import
com.reactnativenavigation.NavigationApplication;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:29:
Error: Packagecom.reactnativenavigation.react does not exist import
com.reactnativenavigation.react.NavigationReactNativeHost;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:30:
Error: Packagecom.reactnativenavigation.react does not exist import
com.reactnativenavigation.react.ReactGateway;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:36:
Error: Symbol not found public class MainApplication extends
NavigationApplication {
^ シンボル: Class NavigationApplication
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:45:
Error: Symbol not found
protected ReactGateway createReactGateway() {
^ シンボル: Class ReactGateway 場所: Class MainApplication
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:8:
Error: Packageandroid.support.annotation does not exist import
android.support.annotation.Nullable;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:12:
Error: Packagecom.reactnativenavigation does not exist import
com.reactnativenavigation.NavigationActivity;
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:18:
Error: Symbol not found public class MainActivity extends
NavigationActivity {
^ シンボル: Class NavigationActivity /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:21:
Error: Symbol not found
protected void onCreate(#Nullable Bundle savedInstanceState) {
^ シンボル: Class Nullable 場所: Class MainActivity
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:44:
Error: Method does not override super
#Override
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:46:
Error: Symbol not found
ReactNativeHost host = new NavigationReactNativeHost(this, isDebug(), createAdditionalReactPackages()) {
^ シンボル: Class NavigationReactNativeHost 場所: Class MainApplication
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:47:
Error: Method does not override super
#Override
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:52:
Error: Symbol not found
return new ReactGateway(this, isDebug(), host);
^ シンボル: Class ReactGateway 場所: Class MainApplication
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:55:
Error: Method does not override super
#Override
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:68:
Error: Symbol not found
new PickerViewPackage(),
^ シンボル: Class PickerViewPackage 場所: Class MainApplication
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:70:
Error: Class FBSDKPackageのコンストラクタ FBSDKPackageは指定された型に適用できません。
new FBSDKPackage(mCallbackManager),
^ 期待値: 引数がありません 検出値: CallbackManager 理由: 実引数リストと仮引数リストの長さが異なります
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:72:
Error: Symbol not found
new RNCWebViewPackage(),
^ シンボル: Class RNCWebViewPackage 場所: Class MainApplication
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/MainApplication.java:79:
Error: Method does not override super
#Override
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:20:
Error: Method does not override super
#Override
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:22:
Error: Symbol not found
super.onCreate(savedInstanceState);
^ シンボル: 変数 super 場所: Class MainActivity /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:26:
Error: Symbol not found
PackageInfo info = getPackageManager().getPackageInfo(
^ シンボル: メソッド getPackageManager() 場所: Class MainActivity
/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:48:
Error: Method does not override super
#Override
^ /Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.java:50:
Error: Symbol not found
super.onActivityResult(requestCode, resultCode, data);
^ シンボル: 変数 super 場所: Class MainActivity ノート:/Users/tenna/Downloads/aitem/android/app/src/main/java/com/aitem/com/aitem/MainActivity.javaは推奨されないAPIを使用またはオーバーライドしています。
ノート:詳細は、-Xlint:deprecationオプションを指定して再コンパイルしてください。 Error25個
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.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it
incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation
warnings and determine if they come from your own scripts or plugins.
See
https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 7s 145 actionable tasks: 2 executed, 143 up-to-date
Could not install the app on the device, read the error above for
details. Make sure you have an Android emulator running or a device
connected and have set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Command failed: ./gradlew installDebug
Error: Command failed: ./gradlew installDebug
at checkExecSyncError (node:child_process:707:11)
at Object.execFileSync (node:child_process:726:15)
at runOnAllDevices (/Users/tenna/Downloads/aitem/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
at buildAndRun (/Users/tenna/Downloads/aitem/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
at /Users/tenna/Downloads/aitem/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12
at processTicksAndRejections (node:internal/process/task_queues:96:5)
click on android folder
click on app folder
click on src folder
click on java folder
click on MainApplication.java file and remove Packagecom.reactnativecommunity.webview in line 9
use latest updated one
npm i react-native-webview
I am trying to compile a basic Kotlin/Native program with just the kotlinc-native CLI compiler rather than a full Gradle build. However, I cannot get the platform.posix library to work, despite compiling on linux for linux.
The source code I am using is:
import platform.posix.exit
fun main() {
println("Should exit with status 10")
exit(10)
}
When compiled with the following build.gradle.kts it works fine:
plugins {
kotlin("multiplatform") version "1.6.10"
}
repositories {
mavenCentral()
}
kotlin {
linuxX64("native") {
binaries {
executable()
}
}
}
However, when compiled from the command-line with:
kotlinc-native test.kt
I get:
test.kt:1:8: error: unresolved reference: platform
import platform.posix.exit
^
test.kt:4:5: error: unresolved reference: exit
exit(10)
^
Anyone know how to get Kotlin/Native compilation working fully without using Gradle? Or is there some magic that Gradle does that makes it work?
Thanks.
I'm trying to compile the following via command-line:
import kotlin.test.assertTrue
fun main(args: Array<String>) {
assertTrue(false)
}
However, the compiler fails with:
$ kotlinc -d MyCode.jar MyCode.kt
MyCode.kt:1:15: error: unresolved reference: test
import kotlin.test.assertTrue
^
What am I missing?
Are org.jetbrains.kotlin:kotlin-test and org.jetbrains.kotlin:kotlin-test-junit specified in dependencies? kotlin.test is not a base module