Tag: 运行时错误

将Kotlin .class文件打包到JAR中执行

在关于“Kotlin – 编译并从Windows命令行运行”的教程之后,有一个缺失的清单: thufir@dur:~/kotlin$ thufir@dur:~/kotlin$ ll total 32 drwxr-xr-x 2 thufir thufir 4096 Oct 27 08:29 ./ drwx—— 46 thufir thufir 16384 Oct 27 08:03 ../ -rw-r–r– 1 thufir thufir 107 Oct 27 08:29 HelloWorld.kt thufir@dur:~/kotlin$ thufir@dur:~/kotlin$ kotlinc HelloWorld.kt -include-runtime -d HelloWorld.jar WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by […]

将字节码转换为dex在实际设备中运行时出错

我更新了kolin版本1.1.4-2,然后我开始在真实的设备上运行我的项目,但它显示这个错误 – > 模块:应用程序build.gradle文件我添加了上次的依赖目标兼容性,但它根本不工作。 每当我在我的设备运行它显示上面的错误 – > apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 26 buildToolsVersion "26.0.1" defaultConfig { applicationId "com.company.projectname" minSdkVersion 17 targetSdkVersion 26 versionCode 2 versionName "1.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: […]

错误:无法找到或加载主类Hello.class

尝试最简单的kotlin你好世界可能: thufir@dur:~/kotlin$ thufir@dur:~/kotlin$ ll total 32 drwxr-xr-x 2 thufir thufir 4096 Oct 27 07:28 ./ drwx—— 46 thufir thufir 16384 Oct 27 06:47 ../ -rw-r–r– 1 thufir thufir 104 Oct 27 07:27 Hello.kt thufir@dur:~/kotlin$ thufir@dur:~/kotlin$ kotlinc Hello.kt WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.intellij.util.text.StringFactory to constructor java.lang.String(char[],boolean) WARNING: […]