无法在Android Studio中执行复制粘贴
我在Android Studio中遇到了两个主要问题。首先,在某些课程中,我无法执行复制粘贴和剪切粘贴(ctrl+c-ctrl+v-ctrl+x)功能。要解决这个问题,我单击“无效缓存/重新启动”,但它立即再次出现故障 第二个问题是(我认为这与第一个问题有关)编译器不能识别已经定义的方法和属性。自动建议等不起作用 我为解决这个问题所采取的步骤是:无法在Android Studio中执行复制粘贴,android,windows,android-studio,ide,Android,Windows,Android Studio,Ide,我在Android Studio中遇到了两个主要问题。首先,在某些课程中,我无法执行复制粘贴和剪切粘贴(ctrl+c-ctrl+v-ctrl+x)功能。要解决这个问题,我单击“无效缓存/重新启动”,但它立即再次出现故障 第二个问题是(我认为这与第一个问题有关)编译器不能识别已经定义的方法和属性。自动建议等不起作用 我为解决这个问题所采取的步骤是: 文件->无效缓存/重新启动 文件->节能模式->禁用 关闭所有打开的选项卡并重新启动 文件->将项目与渐变文件同步 文件->与文件系统同步 删除JDK
- 任务:app:compiledBugaidl无源代码
- 任务:应用程序:CompiledBugRenderScript无源代码
- 任务:app:processDebugJavaRes NO-SOURCE
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用程序级渐变文件
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.lotusif.dump2"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.core:core:1.1.0'
// material widgets
implementation 'com.google.android.material:material:1.2.0-alpha03'
// progress bar with text
implementation "com.github.skydoves:progressview:1.0.3"
// sequence progress
implementation 'com.github.transferwise:sequence-layout:1.0.11'
// flash bar
implementation 'com.andrognito.flashbar:flashbar:1.0.2'
// toggle - switch button
implementation 'com.github.GwonHyeok:StickySwitch:0.0.15'
// Custom Toast message
implementation 'com.github.GrenderG:Toasty:1.4.2'
// liquid effect bar
implementation 'com.mikhaellopez:circularfillableloaders:1.3.2'
// bubble tab bar
implementation 'com.fxn769:bubbletabbar:1.0.3'
//glide image library
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
// scaling layout
implementation 'com.github.iammert:ScalingLayout:1.2.1'
// lottie animation
implementation 'com.airbnb.android:lottie:3.3.1'
//Gson
implementation 'com.google.code.gson:gson:2.8.6'
//RxJava
implementation 'io.reactivex.rxjava2:rxjava:2.2.15'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.daimajia.easing:library:2.1@aar'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
//retrofit
implementation 'com.squareup.retrofit2:converter-gson:2.7.1'
implementation 'com.squareup.retrofit2:retrofit:2.7.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.7.1'
}
更新1.0图像
更新2.0图像
我建议您在另一台计算机上通过从bitbucket中拉出它来打开它,看看它的行为是否相同更新-->使用Windows 10单语言土耳其语的Kotlin库中有一个bug。(也许其他一些单语言Windows发行版也有同样的问题,我还不知道。)Kotlin的一些库不能在土耳其操作系统上工作。我通过安装Windows 10 Pro English解决了这个问题 其他使用Windows10单语言土耳其语的开发者从不同角度面临同样的问题。(及) 旧答案 TL;DR->问题在于使用Kotlin编写的第三方库。我已经将我的Java项目转换为Kotlin,所有有问题的第三方库都运行良好问题是关于Java-Kotlin冲突的 我想与大家分享我是如何解决这些问题的 我一个接一个地完成了上面提到的所有步骤,但我找不到任何解决方案,我决定检查我的第三方库 首先,我禁用了所有第三方库,并查看了未识别已定义方法和属性的类的状态。在禁用第三方库并执行Rebuild Project和Sync Gradle后,这些损坏类的自动建议功能再次开始工作。然后,发现哪些第三方库存在问题,我逐个激活了这些第三方库。我发现哪些第三方库破坏了我的项目 有4个第三方库破坏了我的项目:,和。当我移除这些库时,一切正常。删除库之后,我的Gradle文件如下所示
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.lotusif.dump2"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.core:core:1.1.0'
// material widgets
implementation 'com.google.android.material:material:1.2.0-alpha03'
// progress bar with text BUGGY!
// implementation "com.github.skydoves:progressview:1.0.3"
// sequence progress BUGGY !
// implementation 'com.github.transferwise:sequence-layout:1.0.11'
// flash bar BUGGY !
// implementation 'com.andrognito.flashbar:flashbar:1.0.2'
// toggle - switch button BUGGY !
// implementation 'com.github.GwonHyeok:StickySwitch:0.0.15'
// Custom Toast message
implementation 'com.github.GrenderG:Toasty:1.4.2'
// liquid effect bar
implementation 'com.mikhaellopez:circularfillableloaders:1.3.2'
// bubble tab bar
implementation 'com.fxn769:bubbletabbar:1.0.3'
// android chart library
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
//glide image library
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
// scaling layout
implementation 'com.github.iammert:ScalingLayout:1.2.1'
// lottie animation
implementation 'com.airbnb.android:lottie:3.3.1'
//Gson
implementation 'com.google.code.gson:gson:2.8.6'
//RxJava
implementation 'io.reactivex.rxjava2:rxjava:2.2.15'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.daimajia.easing:library:2.1@aar'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
//retrofit
implementation 'com.squareup.retrofit2:converter-gson:2.7.1'
implementation 'com.squareup.retrofit2:retrofit:2.7.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.7.1'
}
那么,那些破坏我的项目的库的共同特征是什么?我的项目是用Java编写的,但是库是用Kotlin编写的。一秒钟,我不能在Java项目中使用Kotlin库吗。我必须在gradle.properties中添加android.useAndroidX=true
和android.enableJetifier=true
,就是这样。但是,如果我已经在gradle.properties中添加了这些行,但它不起作用呢
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
我不明白为什么kotlin库不能与我的Java项目一起工作。正如您在我的Gradle文件中看到的,我正在使用apply插件:“kotlin android”
和apply插件:“kotlin android extensions”
来支持kotlin
我是如何拯救我的项目的?据我所知,有两种选择。第一种方法是删除这4个第三方库而无法使用它们,第二种方法是将所有Java类转换为Kotlin类(我以前尝试过,但直到禁用所有第三方库后才起作用)。我选择将所有Java类转换为Kotlin类。因此,我能够使用上面提到的4个第三方库
解决这个问题花了我30天。现在,我正在研究Kotlin语言。因此,我的项目运行没有任何问题。您能提供Android Studio的完整屏幕截图吗?b有可能失败