- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在学习这些教程:
我想我卡住的地方是上面页面中的“在 list 文件中声明库组件”。
我猜这意味着库没有被正确导入或者我没有声明什么。事实上,我敢打赌这是我的错,我可能需要在 list 文件或其他东西中声明一些东西。但是,我对“声明 Activity googleplayservices list ”的所有谷歌搜索让我相信也许没有什么可以为这个库声明的 - 否则我肯定会遇到某种例子?
已安装 Google Play 服务
已安装 Google api
没有要安装的更新,所以不可能有任何过时的东西。
我已经导入了库(右键单击我的项目 > 属性 > android > 添加 > 播放服务库)。
尝试勾选和取消勾选“是图书馆”复选框都无济于事。
我已经多次安装并使用项目>clean函数
Eclipse/ADT 多次重启
Description Resource Path Location Type
GooglePlayServicesClient cannot be resolved to a type MainActivity.java /Atapp/src/com/atdev/atapp line 21 Java Problem
Description Resource Path Location Type
mLocationClient cannot be resolved MainActivity.java /Atapp/src/com/atdev/atapp line 184 Java Problem
Description Resource Path Location Type
Syntax error on token "mCurrentLocation", VariableDeclaratorId expected after this token MainActivity.java /Atapp/src/com/atdev/atapp line 162 Java Problem
Description Resource Path Location Type
The method onConnectionFailed(ConnectionResult) of type MainActivity must override or implement a supertype method MainActivity.java /Atapp/src/com/atdev/atapp line 126 Java Problem
(以及其他)。
感谢您的提前建议。第一次发帖,所以我希望我问的正确并且清楚。
list 文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.atdev.atapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.atdev.atapp.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.atdev.atapp.Venue"
android:label="@string/title_activity_venue"
android:parentActivityName="com.atdev.atapp.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.atdev.atapp.MainActivity" />
</activity>
</application>
</manifest>
主要 Activity java:
package com.atdev.atapp;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.content.IntentSender;
import android.location.Location;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.location.LocationClient;
public class MainActivity extends Activity implements
GooglePlayServicesClient.ConnectionCallbacks,
GooglePlayServicesClient.OnConnectionFailedListener {
// ************************************************************************
// GLOBAL CONSTANTS
// Define a request code to send to Google Play services. This code is returned in Activity.onActivityResult
private final static int CONNECTION_FAILURE_RESOLUTION_REQUEST = 9000;
// Set the contents of the venue search field to this string
public final static String VENUE_SEARCH = "com.atroom.atroom.MESSAGE";
// Global variable to hold the current location
Location mCurrentLocation;
// Define a DialogFragment that displays the google play services error dialog
public static class ErrorDialogFragment extends DialogFragment {
// Global field to contain the error dialog
private Dialog mDialog;
// Default constructor. Sets the dialog field to null
public ErrorDialogFragment() {
super();
mDialog = null;
}
// Set the dialog to display
public void setDialog(Dialog dialog) {
mDialog = dialog;
}
// Return a Dialog to the DialogFragment.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return mDialog;
}
}
// ********************************************************************************
// GOOGLE PLAY SERVICES METHODS
// Handle results returned to the FragmentActivity by Google Play services
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// Decide what to do based on the original request code
switch (requestCode) {
case CONNECTION_FAILURE_RESOLUTION_REQUEST :
// If the result code is Activity.RESULT_OK, try to connect again
switch (resultCode) {
case Activity.RESULT_OK :
// Try the request again
break;
}
}
}
// Do the following to test whether Google Play Services are available and take relevant action
private boolean servicesConnected() {
// Check that Google Play services is available
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
// If Google Play services is available
if (ConnectionResult.SUCCESS == resultCode) {
// In debug mode, log the status
Log.d("Location Updates","Google Play services is available.");
// Continue
return true;
// Google Play services was not available for some reason
} else {
// Get the error code
int errorCode = connectionResult.getErrorCode();
// Get the error dialog from Google Play services
Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
errorCode,
this,
CONNECTION_FAILURE_RESOLUTION_REQUEST);
// If Google Play services can provide an error dialog
if (errorDialog != null) {
// Create a new DialogFragment for the error dialog
ErrorDialogFragment errorFragment =
new ErrorDialogFragment();
// Set the dialog in the DialogFragment
errorFragment.setDialog(errorDialog);
// Show the error dialog in the DialogFragment
errorFragment.show(getSupportFragmentManager(),
"Location Updates");
}
}
}
// Location Services calls the following on successful connection to client
@Override
public void onConnected(Bundle dataBundle) {
// Display the connection status
Toast.makeText(this, "Connected", Toast.LENGTH_SHORT).show();
}
// Location Services calls the following if connection to the location client drops because of an error.
@Override
public void onDisconnected() {
// Display the connection status
Toast.makeText(this, "Disconnected. Please re-connect.",
Toast.LENGTH_SHORT).show();
}
// Location Services calls the following if the attempt to connect to Location Services fails
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
/*
* Google Play services can resolve some errors it detects.
* If the error has a resolution, try sending an Intent to
* start a Google Play services activity that can resolve
* error.
*/
if (connectionResult.hasResolution()) {
try {
// Start an Activity that tries to resolve the error
connectionResult.startResolutionForResult(
this,
CONNECTION_FAILURE_RESOLUTION_REQUEST);
/*
* Thrown if Google Play services canceled the original
* PendingIntent
*/
} catch (IntentSender.SendIntentException e) {
// Log the error
e.printStackTrace();
}
} else {
/*
* If no resolution is available, display a dialog to the
* user with the error.
*/
showErrorDialog(connectionResult.getErrorCode());
}
}
// *************************************************************************************
// LOCATION CONNECTION METHODS
// Set the current location to the last known location while a new location is being sought
mCurrentLocation = mLocationClient.getLastLocation();
// *************************************************************************************
// ACTIVITY METHODS
// Do the following when the activity is created
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Create a new location client, using the enclosing class to handle callbacks
mLocationClient = new LocationClient(this, this, this);
}
// Do the following when the Activity becomes visible.
@Override
protected void onStart() {
super.onStart();
// Connect the client. This is in 'onStart' not 'onCreate' as we want to connect whenever
// the activity becomes visible, not just when the activity is started for the first time.
mLocationClient.connect();
}
// Do the following when the Activity is no longer visible.
@Override
protected void onStop() {
// Disconnecting the client invalidates it. This saves battery - we don't want the location
// to run in the background when the app/activity is not in use.
mLocationClient.disconnect();
super.onStop();
}
// Do the following when the menu is created
@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;
}
// Do the following when the Venue Search button is clicked
public void sendVenueSearch (View view) {
Intent intent = new Intent(this, Venue.class);
EditText editText = (EditText) findViewById(R.id.venue_search);
String message = editText.getText().toString();
intent.putExtra(VENUE_SEARCH, message);
startActivity(intent);
}
}
主要 Activity xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<EditText
android:id="@+id/venue_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/button1"
android:ems="10"
android:hint="@+id/venue_search" >
<requestFocus />
</EditText>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/venue_search"
android:layout_alignParentRight="true"
android:layout_marginBottom="34dp"
android:layout_marginRight="31dp"
android:onClick="sendVenueSearch"
android:text="@string/button_venue_search" />
<ListView
android:id="@+id/venueList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/venue_search"
android:layout_below="@+id/button1" >
</ListView>
</RelativeLayout>
最佳答案
我在实现 GooglePlayServicesClient.ConnectionCallbacks
时遇到了同样的问题,因为它无法解析导入,但只需删除 GooglePlayServicesClient.
前缀并重新组织导入即可纠正它.
关于java - 尝试使用 google-play-services_lib 库但出现诸如 'GooglePlayServicesClient not resolved to a type' 之类的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17184913/
所以我的应用程序的评论显示在我的游戏控制台中,但是由于某种原因,当我在 google Play 商店上访问我的应用程序链接并以普通用户的身份查看它时,我没有收到新评论的通知,我的显示了 13 条评论,
一旦我在 2.3 play 项目上运行 'sbt compile',我就不能再使用 'sbt compile' 来编译任何 Play 2.2.x 项目。这是我运行 sbt 命令时的错误。 [info]
我有点困惑,想得到一个解释。 我正在使用 Java Play 2 和 Akka Actor 。我使用 play run 启动系统。 不过,我刚刚看到一个视频,使用了命令: play akka star
当我玩游戏时,我遇到两个选择play.api.mvc和 play.mvc包裹 有什么不同? 最佳答案 从戏! 2 文档: The API available in the play.api packa
从 2.3 迁移到 2.4 后,我收到此错误。我应该使用的正确导入语句是什么? error: value routesImport is not a member of object play.Pla
所以我在 google play 上有一个应用程序已经将近 6 个月了,最近两个月我更新了我的应用程序屏幕截图,从那时起,每次我更新我的应用程序时,我都开始收到应用程序拒绝。 上次我提出上诉并被接受,
我有以下代码: Snapshots.OpenSnapshotResult result; result = Games.Snapshots.open(googleApiClient, "save",
在过去 72 小时内,我为 Google Play 开发者计划支付的 Google 电子钱包付款显示为“您的购买正在处理中”。我知道这可能需要长达 48 小时,但这是他们处理时间最坏情况之后的一整天。
我在 Play 商店发布了应用程序,我不知道为什么应用程序显示预注册,我想为我的用户提供直接下载选项。伸出援手将不胜感激。 最佳答案 instructions for pre-registration
我有一个 PHP 后端,它与 Google Play 服务集成以验证从 APP 进行的购买。购买信息返回收据和签名,我需要验证购买是否正确。 我收到: { ...rest of the data
我在 Google Play Developer Console 上创建了我的 Android 应用程序的草稿。我已经填写了所有需要的信息。必需的步骤之一是“内容评级”。我已填写表格以自动分配 Goo
我已经设置好了 com.typesafe.play play_2.13 2.7.4 在项目 pom.xml 中。但是,当我尝试遵循this tutorial时,语句 pla
我在 Play 商店上发布了一个应用程序,并收到了一些评论。在Google Play开发者控制台中,我在一些评论中看不到应用程序的版本。这是我在“应用程序”标题下找到的内容。 版本代码 — 版本名称
假设 A 是所有者。我希望我们团队的 B、C 和 D 用户能够上传我们应用程序的新版本。这可能吗?来自 this我不太清楚用户有什么样的权限。如果有人对这部分有任何经验,欢迎。 最佳答案 您需要 go
我正在尝试将应用重新提交到 Google Play,但我似乎可以找到一种技术上的方法来实现此目的。 我对“您的应用主要针对 COPPA 定义的 13 岁以下 child 吗?”的回答是肯定的,然后在不
我想分享一下我在分析 Google Play 控制台的新功能时遇到的情况,并尝试找到解决方案。 正如你们许多人可能已经知道的那样,Google 已在 Google Play 控制台上发布了更新并引入了
我有两个用 playframework 编写的应用程序。我想加入另一个。我有一个数据库,我想在它们之间共享我的登录类。应用程序对类、方法、变量使用不同的名称。 我怎样才能实现它?我应该创建 jar 版
对于我的硕士论文,我需要自动将来自 Google Play 的不同 Android 应用程序的信息写入一个文本文件。所以我使用 perl 脚本语言来实现这种自动化。我的 perl 脚本可以在 Goog
我想测试子项目是如何工作的,尤其是 routes在主项目 ( this was not visible before ) 中考虑了子项目的数量。 我在这里阅读了文档: https://github.c
我正在使用 Play 框架 2.1.2,我有一个 handlere 方法返回一个 Promise,如 Play 的 2.1.2 documentation 中所述 但是 Play 抛出编译错误说: C
我是一名优秀的程序员,十分优秀!