使Google Play服务4.0.30与Android Studio 0.4.2和Gradle 0.7一起使用

K4书呆子

似乎不乏解决方案可用于使用Android Studio来使Google Play服务正常工作。我已经尝试了大多数。经过大量的尝试和错误,我得出的结论是,要使这些解决方案中的许多起作用,您必须具有与这些解决方案的作者一样的确切版本组合。这种神奇的组合似乎对任何给定解决方案的成功程度都有非常实际的影响。我相信我尚未找到所用软件版本的解决方案,但还没有排除我错过简单/愚蠢的东西的可能性,请保持谦虚。

因此,这是我的设置,希望有人能够看到该问题:我总是从头开始。这样,我知道我不会从旧版本中留下任何挥之不去的污泥。我正在使用Android Studio(预览版)0.4.2,gradle 0.7(每个build.gradle文件),并且正在尝试使用Google Play服务4.0.30,以便可以使用Google Maps V2。

我已打开SDK管理器并下载了所有更新,并验证是否已加载所有SDK工具,所有API 19(以及许多较低版本,包括14,以及所有Extras,包括支持存储库,支持)。图书馆和Google Play服务。基本上,我在过度下载方面犯了错误。

使用此配置,我可以:

import  com.google.android.gms.*

但没有.maps或其他任何内容,因此没有GoogleMap等。

我将显示一些关键文件的内容。抱歉,长度太长了,但是可能某个地方藏了一个我没想到的东西,我也不想“不显示”问题。所以,请忍受我。...如果有人需要查看更多内容,也请告诉我。谢谢

我的build.gradle:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.0"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
    }
    buildTypes {
        release {
            runProguard true
            proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
        }
    }
    productFlavors {
        defaultFlavor {
            proguardFile 'proguard-rules.txt'
        }
    }
}
dependencies {
    // Google Play Services
    compile 'com.google.android.gms:play-services:4.0.30'
    // Support Libraries
    compile 'com.android.support:support-v4:19.0.0'
    compile 'com.android.support:appcompat-v7:19.0.0'
    compile 'com.android.support:gridlayout-v7:19.0.0'
    compile 'com.android.support:support-v13:19.0.0'
}

我的proguard-rules.txt:

-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

# Keep SafeParcelable value, needed for reflection. This is reqd to support backwards
# compatibility of some classes.
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

# Keep the names of classes/members we need for client functionality.
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

# Needed for Parcelable/SafeParcelable Creators to not get stripped
-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}

我的AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.klhsoftware.k4wmapp" >
    <permission
        android:name="com.klhsoftware.k4wmapp.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>
    <uses-permission android:name="com.klhsoftware.k4wmapp.permission.MAPS_RECEIVE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:hardwareAccelerated="true">
        <activity
            android:name="com.klhsoftware.k4wmapp.MapScreen"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <provider
            android:name="LocationsContentProvider"
            android:authorities="in.wptrafficanalyzer.locationmarkersqlite.locations"
            android:exported="false" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIza<myValue>-tsldkfjdOM" />
    </application>
</manifest>
斯科特·巴塔(Scott Barta)

我们一直发现新添加的库无法正确使用的问题;我认为这是错误https://code.google.com/p/android/issues/detail?id=64508该错误将在0.4.3中修复。同时,

  • 退出Android Studio
  • 备份您的项目
  • 删除所有.iml文件和.idea文件夹
  • 重新启动Android Studio并重新导入您的项目

这与Android Studio突然无法解析符号的答案相同

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

使用Scala收集方法可帮助将[0,0,0,1,1,1,1,0,0,1,1]的列表转换为[3,4,2,2]

preferredTestQuery永不与c3p0 0.9.5.2和Tomcat 7一起使用

当Google Play服务在应用和设备上不同时,使用融合位置获取CurrentLocation 0

一起使用startsWith和paste0

Android Studio Clock Set Time仅显示0或30

如何找出哪个磁盘是“ SD 0:4:0:0”

Google Play支援的装置0

为什么Bpf允许ether [0:2]和ether [0:4]但不允许ether [0:3]?

为什么 int arr[]={0,3,2,4,5,6,7}; 给出错误和 int arr[7]={0,3,2,4,5,6,7}; 不是

[0,1,2,3,4]和[[0],[1],[2],[3],[4]]和有什么区别?

Google图表-定制视图-列索引0-4

创建序列0、0、0、0、0、1、1、1、1、1、2、2、2、2、2、3、3、3、3、3、4、4、4、4、4 ,带有seq()的4

声纳,Gradle和Android返回0问题

如何解释sybase RESTRICT运算符(VA = 1)(4)(0)(0)(0)(0)

Google Play应用更新了0个受支持的Android设备

Google Play商店显示0个受支持的Android设备

Android studio (0,0) 在设备的右上角

使用request.getRemoteAddr()返回0:0:0:0:0:0:0:0:1

如何使用a [0]-a [0] a [1]-a [0] a [1] a [2]输出数组

b中以字节为单位的b(4)中的0、0、0、0在b中的0是多少?

使用gradle插件0。*。*在Android Studio 1.0+中打开项目

strcat()和read()如何在C中与'\ 0'一起使用

消息响应发生错误代码为0xC0C01B4C和0xc0c016b5的僵尸

我希望输出像[[0,0,0,0,],[0,1,0,0],[0,2,0,0],[0,3,0,0]]

glcreateShader在Android Studio中使用opengl es 2.0返回0

reg [7:0] a [3:0] 和 reg [7:0] a [0:3] 有什么区别

malloc:释放的对象0x7fd4f4c8bbd0的校验和不正确:释放后可能已修改

libimobiledevice4,未满足的依赖关系和ErrorBrokenCount> 0

Auth0、Angular 4 和 ASP.NET Core