我今天打开了我的工作室,Android没有识别Kotlin文件。.kt文件开始显示为一个普通文件。我检查了我的插件,我还有Kotlin插件。我又试着卸载和安装它。但没用。
我试着把我的项目建在航站楼上,而且效果很好。但是Android工作室不理解Kotlin文件。
配置:
Android Studio 3.1
科特林1.2.41
操作系统: MacOS Sierra
我刚刚在我的Android项目中启用了Kotlin,我偶然发现了一个警告。在第二个构建(构建->重建项目)之后,此警告将显示在消息下面:
Warning:Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.2.10/85fe1811f3e586d0cc53aba1394d80
我已经将kotlin插件安装到我的安卓工作室project.The代码中,符合一个问题。当我从java类调用它时,它也会执行。它给了我一个警告:“一些附加在这个项目上的Kotlin库不支持format.Please更新库或插件”。println()函数在IDE中也不被识别。
test.kt
fun foo(){
println("ad")
}
public class iTar{
public fun printAll( vararg a: String ){
for(item in a)println(item)
}
}
Build
我有一个相当大的错误: A problem occurred configuring root project 'ExoPlayerTest'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.6.1.
Required by:
project :
> Could not resolve com.android
由于我在新的AndroidStudio3.4Canary4上更新了我的项目,gradle同步失败了,因为:
ERROR: variant.getApplicationId() is not supported by feature plugins as it cannot handle delayed setting of the application ID. Please use getApplicationIdTextResource() instead.
Affected Modules: base
I以前在金丝雀3,它工作得很好。。
该项目是一个多功能应用程序,包括一个即时应用程序。
我试图将kmm共享模块添加到我的ios/android应用程序中,但是,我从Xcode运行中获得了这条消息
显示最近的消息:配置项目':shared‘时出现了问题。
> Could not identify build type for Kotlin framework 'shared' built via cocoapods plugin with CONFIGURATION=Staging.
Add xcodeConfigurationToNativeBuildType["Staging"]=NativeBuildType.DEBUG o
在将Kotlin更新到1.2.51之后,我无法构建我的应用程序。我已经无数次地失效了缓存,并且感觉我已经尝试了所有的东西。任何帮助都将不胜感激。我在下面发布了日志和一些代码,希望您能够更好地理解问题--任何帮助都将不胜感激。谢谢!
日志
e: java.lang.NoClassDefFoundError: org/jetbrains/kotlin/resolve/checkers/DeclarationCheckerContext
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang
在我将ObjectBox添加到我的Android项目之前,一切都很好,所以我在构建该项目时遇到了以下错误。
Duplicate class javax.annotation.CheckForNull found in modules jetified-jsr305-3.0.2.jar (com.google.code.findbugs:jsr305:3.0.2) and jetified-jsr305-3.0.2.jar (jsr305-3.0.2.jar)
我甚至把jsr305排除在ObjectBox之外,但它不起作用。
objectboxVersion = '2.5.1'
我对Dagger没有任何问题,因为我没有在我的项目中添加Realm,在我的项目中添加了它之后,我希望我可以成功地构建我的项目,但我现在得到了这个错误:
Can not resolve symbol DaggerApplicationComponent
我想在我的应用程序上需要Realm,但我不能删除它,但我在Logcat上没有得到任何其他错误,知道问题是什么,我应该修复它,但我不确定如何解决这个问题
当我在build.gradle中使用这些代码行时,我不会遇到问题
apply plugin: 'com.android.application'
apply plugin:
我使用的是测试版Kotlin和Android-Studio频道。在更新到最新版本后,我得到了一些gradle同步错误。
下面是我从事件日志中复制的日志:
Error:Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0-rc-39.
Searched in the following locations:
file:/home/yourpc/Android/android/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-3
我遵循了安卓的解毒指南在我的反应-本机项目- 上安装。但是在运行react-native run-android之后,构建了这个应用程序。我得到以下错误评估项目:detox
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\brian\Documents\Projects\react-native-prototyping\node_modules\detox\android\detox\build.gradle' line: 2
* What went wrong:
A pr
更新Android工作室项目并迁移到Kotlin dsl。我看到上面的警告包装了buildFeatures块,在这里我启用了dataBinding和最近的视图绑定特性,我的AS和gradle,kotlin插件版本如下:
AndroidStudioV4.0
// defined in buildSrc\build.gradle.kts
val kotlinVersion = "1.3.71"
val gradleVersion = "4.0.0"
除了在我的(应用程序) build.gradle.kts中的所有3行中的这个块上的警告之外,一切都很
我有一个包含多个库模块的大型Android项目。它们都使用Kotlin,而且很多都启用了数据绑定。项目和所有模块的构建和运行都很好,没有错误。
然而,对于我认为是误报的每个模块,我在Gradle同步日志中都收到了警告:
> Configure project :feature-a
Kotlin plugin is applied to the project :feature-a but we cannot find the KaptTask. Make sure you apply the kotlin-kapt plugin because it is necessary to us