我想将Google Play服务库导入(并使用)到现有的Android项目中,但我正在努力解决必须存在的依赖问题.
谷歌编写的所有文档都基于Eclipse.我们使用IntelliJ IDEA.
我知道的事情:
我做过的事情:
项目结构看起来像这样(名称故意模糊):

注意:在大多数情况下,我尝试检查并取消选中导出复选框,并尝试同时将其添加到sherlockbar模块,仅用于测试.我知道这些是很多组合,但是哦.
1)添加一个Jar或目录(知道这是错的,我试过).并指向google play module/libs中的.jar,名为:google-play-services.jar.
2)添加一个库(然后将其添加到项目中)
3)添加模块依赖项(选择主项目时).这会显示一个像这样的弹出窗口:

即使我可以引用一个PlusClient并获得正确的导入,当我尝试在我的布局xml中添加一个SignInButton时,我收到一个错误.
粘贴整个XML布局是没有意义的,因为它没有任何奇怪的东西,它只是一个带有一些textview的RelativeLayout.我像这样添加了g +按钮:
  <com.google.android.gms.common.SignInButton
    android:id="@+id/sign_in_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/logo_login"
    android:layout_marginBottom="30dip" />
就像谷歌说的那样.
可能出现问题的第一个迹象是IntelliJ警告您元素"在这里无效",但我认为这是视觉设计师的限制而不是真正的问题.
但是,当我运行该项目时,我得到了这个:
07-30 17:50:44.854: ERROR/ActivityThread(22324): Failed to inflate
    android.view.InflateException: Binary XML file line …android intellij-idea actionbarsherlock google-play-services
我通过下载库,将其添加到工作区,然后将其作为库引用,使Google Maps Android API v2在我的Android应用程序上完美运行.
但是一旦包含Map Fragment的活动开始,我仍然会收到此错误
Could not find class 'maps.i.k', referenced from method maps.z.ag.a
顺便说一下,我正在使用支持地图片段
这个错误似乎不会影响我,也不会崩溃应用程序或任何东西,我是否应该费心修复它?
添加了清单 PS E_SelectJourney是我显示和使用地图的地方
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.HelloMap.AndroidApp"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />
    <permission
        android:name="com.HelloMap.AndroidApp.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />
    <uses-permission android:name="com.HelloMap.AndroidApp.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-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <application
        android:allowBackup="true"
        android:configChanges="orientation"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.Sherlock" >
        <uses-library
            android:name="com.google.android.maps"
            android:required="true" />
        <activity
            android:name="com.HelloMap.AndroidApp.A_SplashScreen" …android android-maps android-library google-maps-mobile android-debug
我正在尝试使用Google Mobile Adds SDK.
我在此处遵循了指南:https://developers.google.com/mobile-ads-sdk/docs/#play但在运行程序时出现了一些错误.
广告似乎正在运行,但我收到以下错误(每次加载广告时似乎发生了3次):
GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
我导入了google_play_services-lib并且无法解决此问题.
如果我在不使用测试设备的情况下运行广告,我也会多次出现警告:
PicturePileLayerContent: Warning: painting PicturePile without content!
我一直在开发使用Google Drive API的Android应用.它最初是从这里的quickstart示例构建的.简化的API调用序列(此处未显示正确的错误处理)是:
 GoogleAccountCredential cred = GoogleAccountCredential.usingOAuth2(this, DriveScopes.DRIVE_FILE);
 cred.setSelectedAccountName("...");  
 Drive drvSvc = new Drive.Builder (AndroidHttp.newCompatibleTransport(), new GsonFactory(), cred).build();
 FileList gooLst = drvSvc.files().list().setMaxResults(MAX_DOWN).setQ(_rqst).execute();
它一直工作正常,我即将发布我的应用程序.但突然之间,在Drive API更新后,我收到了警告
不推荐使用GoogleAccountCredential类型中使用OAuth2(Context,String,String ...)的方法
发生了什么?还有另一种获取凭证的方法吗?是否有可在任何地方使用的快速启动示例的编辑版本?
提前感谢您的任何澄清.肖恩
每当我尝试运行Google Map API v2项目时,都会显示以下错误"找不到Google Play服务资源.检查项目配置以确保包含资源." 实际上,每当点击列表项时我都试图将标记添加到特定位置,但我没有看到任何标记,而是让设备中的应用停止工作消息.然后我检查了sdk管理器,Google Play服务有一个更新,我下载了它,但错误就在那里.所以请任何人帮忙.
这个bug一直存在.(我确保"谷歌地图Android API v2"是打开的.)
这是MainActivity.java:
package com.example.maptest;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
public class MainActivity extends FragmentActivity { 
    @Override     
      protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }     
}
表现:
    <uses-sdk
        android:minSdkVersion="17"
        android:targetSdkVersion="17" />
     <permission
        android:name="com.example.maptest.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />
    <uses-permission 
        android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="com.example.maptest.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> …从AdMobs开始,我遇到了一些奇怪的问题.
第一个问题
当我尝试通过此代码添加我的横幅时:
        layout = (RelativeLayout) findViewById(R.id.adprincipal);
    adView = new AdView(this);
    adView.setAdUnitId("my unit id");
    adView.setAdSize(AdSize.BANNER);
    AdRequest adRequest = new AdRequest.Builder()  
    .addTestDevice("my device")  
    .build();
    // Load the adView with the ad request.
    adView.loadAd(adRequest);
    layout.addView(adView);
如果我设置了大小AdSize.SMART_BANNER,我什么也得不到,但是我得到了一个测试横幅AdSize.BANNER但是ANYWAY(甚至是BANNER和SMART_BANNER)这是我从LogCat获得的:
当横幅时
12-30 04:41:00.380:W/ResourceType(27407):getEntry失败,因为entryIndex 13超出类型entryCount 5
12-30 04:41:00.380:W/ResourceType(27407):无法在包0中输入0x7f0b000d(t = 10 e = 13)(错误-2147483647)
12-30 04:41:00.380:E/GooglePlayServicesUtil(27407):找不到Google Play服务资源.检查项目配置以确保包含资源.
12-30 04:41:00.400:W/ResourceType(27407):getEntry失败,因为entryIndex 13超出类型entryCount 5
12-30 04:41:00.400:W/ResourceType(27407):无法在包0中输入0x7f0b000d(t = 10 e = 13)(错误-2147483647)
12-30 04:41:00.400:E/GooglePlayServicesUtil(27407):找不到Google Play服务资源.检查项目配置以确保包含资源.
12-30 04:41:02.111:I/GATE(27407):DEV_ACTION_COMPLETED
12-30 04:41:02.111:I/Ads(27407):广告已完成加载.
当SMART_BANNER
12-30 04:48:27.476:W/ResourceType(29507):getEntry失败,因为entryIndex 13超出类型entryCount 5
12-30 04:48:27.476:W/ResourceType(29507):无法在包0中输入0x7f0b000d(t = 10 …