我试图在我的应用中实施Google地方选择器,但我遇到了以下错误。我该如何解决?我认为没有导入正确的谷歌地方选择器和记录器库文件。非常感谢帮助谢谢!
C:\Users\ACEM\Downloads\Compressed\MRestro4_2\MRestro4\app\src\main\java\com\golo\acer\mrestro4\android\common\activities\SampleActivityBase.java
Error:(22, 41) error: package com.example.android.common.logger does not exist
Error:(23, 41) error: package com.example.android.common.logger does not exist
Error:(47, 9) error: cannot find symbol class LogWrapper
Error:(47, 37) error: cannot find symbol class LogWrapper
Error:(48, 9) error: cannot find symbol variable Log
Error:(50, 9) error: cannot find symbol variable Log
C:\Users\ACEM\Downloads\Compressed\MRestro4_2\MRestro4\app\src\main\java\com\golo\acer\mrestro4\google\playservices\placepicker\cardstream\CardStreamFragment.java
Error:(30, 51) error: package com.example.google.playservices.placepicker does not exist
Error:(59, 39) error: package R does not exist
Error:(60, 63) error: package R does not exist
C:\Users\ACEM\Downloads\Compressed\MRestro4_2\MRestro4\app\src\main\java\com\golo\acer\mrestro4\google\playservices\placepicker\cardstream\CardStreamLinearLayout.java
Error:(37, 41) error: package com.example.android.common.logger does not exist
Error:(38, 51) error: package com.example.google.playservices.placepicker does not exist
Error:(140, 13) error: cannot find symbol variable Log
Error:(147, 13) error: cannot find symbol variable Log
Error:(149, 54) error: package R does not exist
Error:(165, 13) error: cannot find symbol variable Log
Error:(173, 49) error: package R does not exist
Error:(181, 13) error: cannot find symbol variable Log
Error:(233, 9) error: cannot find symbol variable Log
Error:(400, 22) error: package R does not exist
Error:(403, 43) error: package R does not exist
Error:(416, 52) error: package R does not exist
Error:(423, 21) error: cannot find symbol variable Log
C:\Users\ACEM\Downloads\Compressed\MRestro4_2\MRestro4\app\src\main\java\com\golo\acer\mrestro4\google\playservices\placepicker\PlacePickerFragment.java
Error:(30, 46) error: package com.google.android.gms.location.places does not exist
Error:(31, 49) error: package com.google.android.gms.location.places.ui does not exist
Error:(33, 62) error: package com.example.google.playservices.placepicker.cardstream does not exist
Error:(34, 62) error: package com.example.google.playservices.placepicker.cardstream does not exist
Error:(35, 62) error: package com.example.google.playservices.placepicker.cardstream does not exist
Error:(36, 62) error: package com.example.google.playservices.placepicker.cardstream does not exist
Error:(102, 28) error: package PlacePicker does not exist
Error:(102, 74) error: package PlacePicker does not exist
Error:(153, 23) error: cannot find symbol class Place
Error:(153, 37) error: cannot find symbol variable PlacePicker
Error:(162, 38) error: cannot find symbol variable PlacePicker
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Information:Total time: 6.081 secs
Information:34 errors
Information:0 warnings
Information:See complete output in console
更新:
我的项目Gradle代码:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
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 {
mavenCentral()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的模块Gradle代码:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.golo.acer.mrestro4"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services-analytics:9.4.0'
compile 'com.google.android.gms:play-services-location:9.4.0'
}
更多错误:
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2340Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTasks900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalytics900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCommon900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCore900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseIid900Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
Parsing json file: C:\Users\ACEM\Downloads\Compressed\MRestro4_2\MRestro4\app\google-services.json
:app:generateDebugResources
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C:\Users\ACEM\Downloads\Compressed\MRestro4_2\MRestro4\app\src\main\java\com\golo\acer\mrestro4\google\playservices\placepicker\PlacePickerFragment.java
Error:(33, 62) error: package com.example.google.playservices.placepicker.cardstream does not exist
Error:(34, 62) error: package com.example.google.playservices.placepicker.cardstream does not exist
Error:(35, 62) error: package com.example.google.playservices.placepicker.cardstream does not exist
Error:(36, 62) error: package com.example.google.playservices.placepicker.cardstream does not exist
C:\Users\ACEM\Downloads\Compressed\MRestro4_2\MRestro4\app\src\main\java\com\golo\acer\mrestro4\android\common\activities\SampleActivityBase.java
Error:(22, 41) error: package com.example.android.common.logger does not exist
Error:(23, 41) error: package com.example.android.common.logger does not exist
Error:(47, 9) error: cannot find symbol class LogWrapper
Error:(47, 37) error: cannot find symbol class LogWrapper
Error:(48, 9) error: cannot find symbol variable Log
Error:(50, 9) error: cannot find symbol variable Log
C:\Users\ACEM\Downloads\Compressed\MRestro4_2\MRestro4\app\src\main\java\com\golo\acer\mrestro4\google\playservices\placepicker\cardstream\CardStreamFragment.java
Error:(30, 51) error: package com.example.google.playservices.placepicker does not exist
Error:(59, 39) error: package R does not exist
Error:(60, 63) error: package R does not exist
C:\Users\ACEM\Downloads\Compressed\MRestro4_2\MRestro4\app\src\main\java\com\golo\acer\mrestro4\google\playservices\placepicker\cardstream\CardStreamLinearLayout.java
Error:(37, 41) error: package com.example.android.common.logger does not exist
Error:(38, 51) error: package com.example.google.playservices.placepicker does not exist
Error:(140, 13) error: cannot find symbol variable Log
Error:(147, 13) error: cannot find symbol variable Log
Error:(149, 54) error: package R does not exist
Error:(165, 13) error: cannot find symbol variable Log
Error:(173, 49) error: package R does not exist
Error:(181, 13) error: cannot find symbol variable Log
Error:(233, 9) error: cannot find symbol variable Log
Error:(400, 22) error: package R does not exist
Error:(403, 43) error: package R does not exist
Error:(416, 52) error: package R does not exist
Error:(423, 21) error: cannot find symbol variable Log
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileDebugJavaWithJavac FAILED
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Information:Total time: 19.609 secs
Information:27 errors
Information:0 warnings
Information:See complete output in console
碎片错误:
答案 0 :(得分:1)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
}
}
allprojects {
repositories {
jcenter()
}
}
App build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.golo.acer.mrestro4"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
}
apply plugin: 'com.google.gms.google-services'