我最近更改了Windows操作系统,并刚安装了Android Studio。我从Git克隆了我的Android项目,该项目运行良好。但是现在在最新情况下它不起作用。我不知道缺少什么。 import classes showing error
我没有更改gradle文件。
我的项目级别gradle文件。
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
//maven { url "http://jcenter.bintray.com"}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
// maven { url "http://jcenter.bintray.com"}
mavenCentral()
google()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的应用程序级别gradle文件
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
jcenter()
}
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.cir****.d********"
vectorDrawables.useSupportLibrary = true
minSdkVersion 16
targetSdkVersion 27
versionCode 40
versionName "6.1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/services/javax.ws.rs.ext.MessageBodyReader'
exclude 'META-INF/services/javax.ws.rs.ext.MessageBodyWriter'
exclude 'META-INF/jersey-module-version'
exclude 'META-INF/services/com.sun.jersey.spi.inject.InjectableProvider'
}
dexOptions {
javaMaxHeapSize "4g"
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
aaptOptions
{
cruncherEnabled = false
}
}
dependencies {
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation files('libs/gson-2.2.4.jar')
implementation files('libs/json-simple-1.1.jar')
implementation files('libs/httpmime-4.0.1.jar')
implementation files('libs/PGSDK_V2.1')
implementation files('libs/apache-mime4j-0.6.jar')
implementation files('libs/hibernate-jpa-2.0-api-1.0.1.Final.jar')
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-vision:15.0.2'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'me.leolin:ShortcutBadger:1.1.4@aar'
implementation 'com.edwardvanraak:MaterialBarcodeScanner:0.0.6-ALPHA'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.razorpay:checkout:1.4.7'
implementation 'com.msg91.sendotp.library:library:2.8'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.volley:volley:1.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true
}
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
implementation 'gun0912.ted:tedbottompicker:1.1.0'
implementation 'com.kofigyan.stateprogressbar:stateprogressbar:0.0.6'
implementation 'com.google.android.gms:play-services-analytics:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
我已完成清理,重建,使缓存/重新启动无效,使用gradle文件同步项目,删除了.gradle文件夹并浪费了1天的时间来解决此问题。如果需要,我准备共享其他代码。
答案 0 :(得分:0)
经过几天的挠挠,我以另一种方式解决了这种头痛。如果我通过SSH密钥克隆master分支,则会出现上述错误。因此,为了进行跟踪,我合并了所有正在发展的分支并克隆了。头痛仍然存在。
因此,我打开了Git Bash,并使用以下命令克隆了属于我的特定分支(不是master)。
git clone --single-branch -b sub_branch_name url
现在问题解决了。我不知道master分支有什么问题。