【发布时间】:2019-12-28 16:10:29
【问题描述】:
我在 Android Studio 中遇到了两个主要问题。首先我不能执行 copy-paste 和 cut-paste (ctrl+c - ctrl+v - ctrl+x) 某些职业的能力。为了解决这个问题,我点击“无效缓存/重新启动”,但它立即再次崩溃。
第二个问题是(我认为它与第一个问题有关)编译器无法识别已经定义的方法和属性。自动建议等不起作用。
我为尝试解决问题所采取的步骤是;
- 文件 -> 无效缓存/重新启动,
- 文件 -> 省电模式 -> 禁用,
- 关闭所有打开的选项卡并重新启动,
- 文件 -> 将项目与 Gradle 文件同步,
- 文件 -> 与文件系统同步,
- 删除JDK并重新安装,
- 删除 Android Studio 并重新安装,
- 删除已下载的 SDK 文件和“.Android”文件夹,
- 禁用并删除所有插件。
- 在文件 -> 设置 -> 键盘映射中检查复制粘贴键盘映射
- 将项目从 bitbucket 拉到不同的 2 台计算机上
- 新建项目,用 NotePad++ 复制整个项目类到 新项目
- 尝试将所有 Java 代码转换为 Kotlin,无法转换
这是我的系统规格; Windows 10 家庭单一语言 (TR),版本 1909。16 GB 内存。 Android Studio 3.5.3 和 Gradle 版本 3.5.3
我已经阅读了所有关于相同问题的帖子,但没有运气(这些帖子仅关于 MAC 和 Linux 平台)。
更新 1.0 -> 我发现有些类不能做上述操作,但有些类可以。
我意识到,没有不能执行我上面描述的操作的类的图标。 (有时会神奇地出现“J”图标,当我点击另一个类时,这个 J 图标会立即消失。)我认为 Android Studio 的 gradle 或文件系统无法将这些文件识别为类。
更新 2.0 -> 我注意到,当我单击 DuoFragment 的结构部分(其中有 500 多行代码和一个未编译的类)时,无法加载任何内容。 DuoFragment 尺寸是否更大以处理?
另外当我检查Build部分时,有些进程无法运行(不知道这是否正常);
- 任务:app:compileDebugAidl NO-SOURCE,
- 任务:app:compileDebugRenderscript NO-SOURCE,
- 任务:app:processDebugJavaRes NO-SOURCE
更新 3.0 ->
这是我的 Gradle 文件。 项目级 Gradle 文件:
// 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
}
应用级 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
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 图片
【问题讨论】:
-
你能提供你的 Android Studio 的完整截图吗?失败的构建/gradle 同步(请参阅事件日志或运行)可能会破坏功能。
-
添加了 Android Studio @JakeSteam 的完整截图。 Gradle 同步成功,如果我不添加任何额外的代码 sn-p。 (我整个项目代码来自Bitbucket)
-
您是否检查过复制和粘贴是否在浏览器或文本编辑器等其他地方工作?
-
是的,它有效。它不能只工作某些类(就像我说的 DuoFragment() 类)@SanketVekariya
-
你能告诉我们你的 build.gradle 吗? (来自项目和主模块)。您是否为项目定义了特定的 java.source 位置?
标签: android windows android-studio ide