0
我完成了Firebase友好聊天教程(https://codelabs.developers.google.com/codelabs/firebase-android/#0),聊天正常運行。我試圖通過添加一個新的活動來擴展它:app,New,Activity,Empty Activity。活動添加後立即我得到這個gradle生成錯誤:無法在Android Studio中添加活動
Error:(46, 0) Could not get unknown property 'compile' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
<a href="openFile:C:\Users\apand\AndroidStudioProjects\android-startPure\play\app\build.gradle">Open File</a>
這也是錯誤,也開始教程代碼(android-start)發生。我如何解決這個問題,以便可以將其他活動添加到此代碼中?
這裏是從模塊中的build.gradle代碼:
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.google.firebase.codelab.friendlychat"
minSdkVersion 14
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'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile
'com.android.support:design:25.1.1'compile
'com.github.bumptech.glide:glide:3.7.0'compile
'de.hdodenhof:circleimageview:1.3.0'compile
'com.android.support:appcompat-v7:25.1.1'compile
'com.google.android.gms:play-services-auth:10.2.0'compile
'com.google.firebase:firebase-database:10.2.0'
compile 'com.google.firebase:firebase-storage:10.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.google.firebase:firebase-config:10.2.0'
compile 'com.google.android.gms:play-services-appinvite:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'com.google.android.gms:play-services-ads:10.2.0'
compile 'com.google.firebase:firebase-crash:10.2.0'
compile 'com.google.firebase:firebase-appindexing:10.2.0'
compile 'com.firebaseui:firebase-ui-database:0.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:25.1.1'
}
apply plugin: 'com.google.gms.google-services'
取代它添加'build.gradle'文件 –
的的build.gradle加入。如上所述,示例代碼工作得很好,我聊天和一切。正是當我按照描述添加新的活動時,我得到了錯誤。爲什麼只是將一個新的活動添加到可以正常工作的代碼中會導致此類型的Gradle生成崩潰?任何人都可以通過友好聊天教程代碼複製此內容嗎? –
@Aneel Panfey,Atef意思是在這裏發佈你的gradle文件。 – azizbekian