【发布时间】:2015-03-09 22:25:54
【问题描述】:
我有一个在没有 Gradle 的情况下使用 IntelliJ 开发的旧项目的问题。我想将它迁移到 Android Studio 和 Gradle,但我遇到了很多问题。由于项目比较老,所以使用了旧的 Google Play Services 版本。在 Intellij 中,我刚刚将旧 gps 的 libproject 添加到依赖项(google_play_services_5089000_r19)中,一切正常。在 Android Studio 中,我设法通过将其添加为库模块并将 compile project(':segmentedradios') 添加为 gradle 依赖项来添加其他库,但我无法使 gps 库工作。我尝试将其添加为模块,但 Android Studio 在指向 libroject 库的目录后说“未选择模块”。我也尝试将其添加为 gradle 依赖项,但我不断收到如下错误:
error: package com.google.android.gcm does not exist
error: package com.google.android.maps does not exist
error: cannot find symbol variable GCMRegistrar
尽管我尝试了大约 10 种不同的解决方案,但该项目仍然无法运行。如何解决?
分级:
apply plugin: 'com.android.application'
android {
compileSdkVersion "Google Inc.:Google APIs:18"
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "my_package.app_name"
minSdkVersion 14
targetSdkVersion 18
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile files('libs/libGoogleAnalyticsV2.jar')
compile project(':segmentedradios')
compile 'com.google.android.gms:play-services:5.0.89'
}
【问题讨论】:
标签: android android-gradle-plugin google-play-services android-build