我正在处理一个项目,并为该项目添加了一些依赖项。但是我在应用级 gradle.build 文件中遇到了一些错误 我正在使用Android Studio 3.1新版本。所有设置都是默认设置,我不会更改任何内容。所有设置都带有3.1
的新下载版本在此行implementation 'com.android.support:appcompat-v7:25.4.0'
我的问题是无法在Android Studio模拟器中运行项目
这是我的应用级build.gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
defaultConfig {
applicationId "com.blogapp.anu.blogapp"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support:recyclerview-v7:25.4.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.google.firebase:firebase-storage:11.0.4'
implementation 'com.google.firebase:firebase-config:11.0.4'
implementation 'com.google.firebase:firebase-core:11.0.4'
implementation 'com.google.firebase:firebase-messaging:11.0.4'
implementation 'com.android.support:cardview-v7:25.4.0'
implementation 'com.squareup.picasso:picasso:2.71828'
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
compile 'com.firebaseui:firebase-ui-database:0.4.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
似乎我所有人都使用相同的版本。我已经阅读了一些问题并应用它们,但不适合我。
这是我的项目级别
// 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.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是我现在使用的Android SDK平台
GroupBy.transform
在我引用的所有课程的每个实例中
R.id.something
,R为红色,表示"cannot resolve symbol R
"。
有人知道我的代码有什么问题吗?
答案 0 :(得分:2)
在app level gradle中添加此内容
buildToolsVersion '27.0.3'
implementation com.android.support:cardview-v7:26.1.0' implementation 'com.android.support:appcompat-v7:26.1.0' implementation
'com.android.support:recyclerview-v7:26.1.0
在项目级别gradle
中添加此项classpath 'com.google.gms:google-services:3.2.1'
答案 1 :(得分:0)
尝试这个
实施'com.android.support:appcompat-v7:25。+'
答案 2 :(得分:0)
解决方案1:
如果您进行了一些重大更改,则需要重新启动 Android工作室 File->Invalidate caches/Restart
解决方案2: 如果您使用的是外部库:
转到File -> Settings -> Compiler
现在检查使用外部版本清理并重建..
然后重建项目
解决方案3:
更改为buildToolsVersion "25.0.3"
添加dependencies
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
答案 3 :(得分:0)
请您尝试更换2行
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
compile 'com.firebaseui:firebase-ui-database:0.4.0'
与
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
implementation 'com.firebaseui:firebase-ui-database:0.4.0'
此外,如果R没有导入到您的包导入状态,您可以在代码中导航到R关键字并按Alt + Enter
,然后从菜单中选择import class
。
答案 4 :(得分:-1)
这是因为你的firebase实现问题......
添加此...
XMLGregorianCalendar