我正在使用 Android Studio 2.3 & 这是 app level gradle ,与播放服务完美配合 10.0.1
apply plugin: 'com.android.application'
ext {
retrofitVersion = "2.1.0"
sdkVersion = 25
supportLibVersion = '25.3.0'
playServiceVersion = '10.0.1'
}
android {
compileSdkVersion sdkVersion
buildToolsVersion "25.0.2"
// As httpclient is deprecated so we use this one.
useLibrary 'org.apache.http.legacy'
dataBinding {
enabled = true
}
defaultConfig {
applicationId "com.twebexponent.artwork"
minSdkVersion 19
targetSdkVersion sdkVersion
versionCode 17
versionName "1.0.17"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// For the device lower than version 5.0
vectorDrawables.useSupportLibrary = true
// For multidex
multiDexEnabled true
}
dexOptions {
preDexLibraries = false
}
lintOptions {
abortOnError false
// For fragment issue non default constractor
checkReleaseBuilds false
}
buildTypes {
release {
// Enable ProGuard
minifyEnabled true
shrinkResources true
// Common release options
zipAlignEnabled true
debuggable false
jniDebuggable false
// Notice that the default ProGuard file (SDK-provided) also enables optimization
// Here we also include a third file which disables the logging (see below)
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
/*debug {
// We enable ProGuard also for debug builds
minifyEnabled true
// Notice that the default ProGuard file (SDK-provided) differs from the release one
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}*/
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
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'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
mavenCentral()
}
repositories {
jcenter()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:palette-v7:${supportLibVersion}"
compile "com.android.support:cardview-v7:${supportLibVersion}"
compile "com.android.support:customtabs:${supportLibVersion}"
testCompile 'junit:junit:4.12'
// For design purpose
compile "com.android.support:design:${supportLibVersion}"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "com.android.support:support-vector-drawable:${supportLibVersion}"
compile "com.android.support:animated-vector-drawable:${supportLibVersion}"
// For multidex
compile 'com.android.support:multidex:1.0.1'
// For custom tab
compile "com.android.support:customtabs:${supportLibVersion}"
// Firebas push & database & auth and play service location map and cluster(map-util)
compile "com.google.firebase:firebase-messaging:${playServiceVersion}"
compile "com.google.firebase:firebase-database:${playServiceVersion}"
compile "com.google.firebase:firebase-auth:${playServiceVersion}"
compile "com.google.android.gms:play-services-places:${playServiceVersion}"
compile "com.google.android.gms:play-services-location:${playServiceVersion}"
compile "com.google.android.gms:play-services-maps:${playServiceVersion}"
compile 'com.google.maps.android:android-maps-utils:0.5'
// Facebook
compile 'com.facebook.android:facebook-android-sdk:4.17.0'
// For Retrofit
compile 'com.google.code.gson:gson:2.7'
compile "com.squareup.retrofit2:retrofit:${retrofitVersion}"
compile "com.squareup.retrofit2:converter-gson:${retrofitVersion}"
compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
compile "com.squareup.retrofit2:adapter-rxjava:${retrofitVersion}"
// Show image
// compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
// Bottom navigation bar
// compile 'com.aurelhubert:ahbottomnavigation:2.0.1'
// Gallery library
compile 'me.iwf.photopicker:PhotoPicker:0.9.0@aar'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
// Recycler view
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
// Commom.net for ftp
compile 'commons-net:commons-net:3.3'
// FAB
compile 'com.github.clans:fab:1.5.5'
// Paypal
compile 'com.paypal.sdk:paypal-android-sdk:2.13.3'
// Image upload
compile 'org.apache.httpcomponents:httpmime:4.2.1'
compile 'commons-net:commons-net:3.3'
// volley
compile 'com.android.volley:volley:1.0.0'
// Firebase UI
// compile 'com.firebaseui:firebase-ui:1.1.1'
// FirebaseUI Database only
compile 'com.firebaseui:firebase-ui-database:1.1.1'
// FirebaseUI Auth only
compile 'com.firebaseui:firebase-ui-auth:1.1.1'
// FirebaseUI Storage only
compile 'com.firebaseui:firebase-ui-storage:1.1.1'
}
apply plugin: 'com.google.gms.google-services'
这是我的项目级别gradle
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
现在,当我将 playServiceVersion 更改为 10.2.0 时,发生了数据绑定错误。它无法在我的所有Activity中找到所有数据绑定,并且通过我发现错误。以下是 Gradle Console
中的错误E:\workspace all\studio\New_APA_Project\AllPublicArt\app\src\main\java\com\twebexponent\artwork\ui\ArtListCreatedByActivity.java:24: error: package com.twebexponent.artwork.databinding does not exist
import com.twebexponent.artwork.databinding.CreatedByArtBinding;
^
E:\workspace all\studio\New_APA_Project\AllPublicArt\app\src\main\java\com\twebexponent\artwork\ui\ArtListCreatedByActivity.java:47: error: cannot find symbol
CreatedByArtBinding binding;
^
symbol: class CreatedByArtBinding
location: class ArtListCreatedByActivity
E:\workspace all\studio\New_APA_Project\AllPublicArt\app\src\main\java\com\twebexponent\artwork\ui\ArtNewsActivity.java:17: error: package com.twebexponent.artwork.databinding does not exist
import com.twebexponent.artwork.databinding.ArtNewsBinding;
^
E:\workspace all\studio\New_APA_Project\AllPublicArt\app\src\main\java\com\twebexponent\artwork\ui\ArtNewsActivity.java:36: error: cannot find symbol
ArtNewsBinding binding;
^
symbol: class ArtNewsBinding
location: class ArtNewsActivity
E:\workspace all\studio\New_APA_Project\AllPublicArt\app\src\main\java\com\twebexponent\artwork\ui\ChatListActivity.java:20: error: package com.twebexponent.artwork.databinding does not exist
import com.twebexponent.artwork.databinding.ChatListBinding;
^
E:\workspace all\studio\New_APA_Project\AllPublicArt\app\src\main\java\com\twebexponent\artwork\ui\ChatListActivity.java:30: error: cannot find symbol
ChatListBinding binding;
^
symbol: class ChatListBinding
location: class ChatListActivity
E:\workspace all\studio\New_APA_Project\AllPublicArt\app\src\main\java\com\twebexponent\artwork\ui\ChatPanelPage.java:44: error: package com.twebexponent.artwork.databinding does not exist
import com.twebexponent.artwork.databinding.ChatPanelBinding;
^
E:\workspace all\studio\New_APA_Project\AllPublicArt\app\src\main\java\com\twebexponent\artwork\ui\ChatPanelPage.java:45: error: package com.twebexponent.artwork.databinding does not exist
import com.twebexponent.artwork.databinding.SingleRowChatPanelMsgBinding;
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
100 errors
:app:compileDebugJavaWithJavac FAILED
:app:compileDebugJavaWithJavac (Thread[Daemon worker Thread 3,5,main]) completed. Took 2.106 secs.
:app:buildInfoGeneratorDebug (Thread[Daemon worker Thread 3,5,main]) started.
:app:buildInfoGeneratorDebug
Putting task artifact state for task ':app:buildInfoGeneratorDebug' into context took 0.0 secs.
Executing task ':app:buildInfoGeneratorDebug' (up-to-date check took 0.0 secs) due to:
Task has not declared any outputs.
:app:buildInfoGeneratorDebug (Thread[Daemon worker Thread 3,5,main]) completed. Took 0.057 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugJavaWithJavac'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:236)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58)
at org.gradle.execution.taskgraph.ParallelTaskPlanExecutor.process(ParallelTaskPlanExecutor.java:50)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$RunTasksAction.execute(DefaultGradleLauncher.java:256)
at org.gradle.initialization.DefaultGradleLauncher$RunTasksAction.execute(DefaultGradleLauncher.java:253)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:175)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102)
at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71)
at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:50)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$1.execute(RunAsBuildOperationBuildActionRunner.java:43)
at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$1.execute(RunAsBuildOperationBuildActionRunner.java:40)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:75)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:49)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:31)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:48)
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:33)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:99)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:52)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:37)
at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:35)
at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25)
at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:209)
at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:190)
at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:135)
at com.android.build.gradle.tasks.factory.AndroidJavaCompile.compile(AndroidJavaCompile.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:163)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
... 81 more
有趣的是我认为这是Gradle版本2.3的错误,但实际上我尝试使用playservice 10.2.0 构建我的代码到Android studio 2.2.3也在Android工作室中稳定版本2.4 perview 3。
仍然存在错误。我也检查我的外部库都是10.2.0。因此,如果有任何人知道为什么会出现这种游戏服务问题,请告诉我。