谁能告诉我为什么我在AndroidStudio中遇到这个错误?
Execution failed for task ':sampleapp:preBuild'.
> Build Tools Revision 19.0.0+ is required.
Run Code Online (Sandbox Code Playgroud)
我已经从Android SDK管理器安装了Android Build-tools 19.0.1
我已经设置了简单的Facebook登录.对于Android 2.3.6一切正常,用户获得提示登录对话框,输入数据和应用程序继续.我认为这是android版本的错误,但是当手机上安装了facebook应用程序时,它会发现登录不起作用!
测试了这一点:Galaxy Ace 2.3.6 HTC Desire 4.1.2 Galaxy Note 4.1.2 Android模拟器4.1.2
即使是facebook样本也无法正常工作!
每次应用程序执行时 - else {
Log.d("SESSION NOT OPENED", "SESSION NOT OPENED");
}
会议似乎没有打开,但为什么呢?按照本指南 - https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/
码:
Session.openActiveSession(this, true, new Session.StatusCallback() {
@Override
public void call(final Session session, SessionState state, Exception exception) {
if (session.isOpened()) {
Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null) {
Log.d("Access_token", session.getAccessToken());
}
}
});
} else {
Log.d("SESSION NOT OPENED", "SESSION NOT OPENED");
}
} …Run Code Online (Sandbox Code Playgroud) 谁能告诉我我做错了什么?我需要从Google Plus获取访问令牌..
我把它放在我的onConnected()方法中,但我没有获得访问令牌,而是我收到错误...
码:
try {
String token = GoogleAuthUtil.getToken(this, mPlusClient.getAccountName() + "", "oauth2:" + Scopes.PLUS_PROFILE +
"https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email");
Log.d("AccessToken", token);
} catch (UserRecoverableAuthException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (GoogleAuthException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
错误:
08-07 10:10:24.199: E/GoogleAuthUtil(17203): Calling this from your main thread can lead to deadlock and/or ANRs
Run Code Online (Sandbox Code Playgroud)
谁能告诉我从用户那里获取Google Plus访问令牌的正确方法是什么?
我正在使用此示例开发基于位置的应用程序:http://www.androidhive.info/2012/07/android-gps-location-manager-tutorial/
但是当我打开手机时,该位置就不可用了.所以我想在等待位置时显示进度对话框.想在后台使用AsyncTask执行此操作.
您能否提出任何想法以及如何做到这一点?
我的html中有不同的元素,文本大小不同.我想将它们设置为动态,以便为不同的屏幕尺寸显示不同的字体大小.
什么是最好的方式?现在我这样做,但它使代码看起来很丑:
<script>
$(window).resize(function(){
$('#first').css('font-size',($(window).width()*0.2)+'px');
$('h2').css('font-size',($(window).width()*0.02)+'px');
$('h1').css('font-size',($(window).width()*0.03)+'px');
Run Code Online (Sandbox Code Playgroud)
对于两个元素它可以,但我还有更多.没有html/css/javascript的丰富经验所以这就是我想出的.
因为我在学习,所以我想知道什么是最好的方法.
也许你有一些建议如何改善?
我创建了一个asynctask来显示进度对话框,同时解决用户位置.我想运行这个asynctask 30秒,如果在这30秒内我没有找到用户位置,我只想杀死任务并显示错误消息.
到目前为止我的代码是这样的:
userLocation = new AsyncTask<Void, Void, Void>() {
private ProgressDialog locationDialog = new ProgressDialog(MainActivity.this);
@Override
protected void onPreExecute() {
super.onPreExecute();
locationDialog.setMessage(getResources().getString(R.string.getting_location));
locationDialog.setCancelable(false);
locationDialog.setIndeterminate(true);
locationDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
try {
latitude = locationProvider.getLatitude();
longitude = locationProvider.getLongitude();
Thread.sleep(10000);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
// getLocation.cancel(true);
if (latitude != 0 && longitude != 0) {
locationDialog.dismiss();
getData();
} else {
locationDialog.dismiss();
alertDialog.show();
Log.d("Couldn't get location", "Couldn't …Run Code Online (Sandbox Code Playgroud) 以前我得到这样的Facebook用户个人资料图片,一切都很好,直到最近.
但现在每次返回null.
这是网址:
"http://graph.facebook.com/"+userID+"/picture?height=100&type=normal&width=100"
Run Code Online (Sandbox Code Playgroud)
这可能是因为Facebook的重定向吗?因为如果您在浏览器中打开此URL,您将被重定向到以下内容:https://fbcdn-profile-a.akamaihd.net/.......有没有办法来解决这个问题?
这是我的Asynctask:
public class GetUserPicture extends AsyncTask<String, Void, Bitmap> {
ImageView profileImage;
public GetUserPicture(ImageView profileImage) {
this.profileImage = profileImage;
}
@Override
protected Bitmap doInBackground(String... urls) {
String urldisplay = urls[0];
Log.d("SHOW CORRECT URL", urldisplay);
Bitmap bitmap = null;
try {
URL url = new URL(urldisplay);
bitmap = BitmapFactory.decodeStream(url.openConnection().getInputStream());
HttpURLConnection.setFollowRedirects(true);
} catch (Exception e) {
e.printStackTrace();
}
return bitmap;
}
@Override
protected void onPostExecute(Bitmap result) {
if (result != null) {
Log.d("Not null", "NOT NULLL"); …Run Code Online (Sandbox Code Playgroud)