Android的工作室 - 无法打开PNG文件 [英] Android Studio - Unable to open PNG file

查看:322
本文介绍了Android的工作室 - 无法打开PNG文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想给Facebook融入我的应用程序,但是当它运行在Android的工作室,我得到这样的:

I'm trying to integrate Facebook into my app, but while running it in Android Studio, I get this:

摇篮:执行失败的任务:AplikaceBeta1.0.1:mergeDebugResources。   无法运行命令:       C:\ Users \用户大卫\应用程序数据\本地\机器人\机器人工作室\ SDK \集结TOOLS \的Andr​​oid 4.2.2 \ aapt.exe小号-i C:\Users\David\Desktop\facebook-android-sdk-3.5\facebook-android-sdk-3.5\samples\AplikaceBeta1.0.1Project\AplikaceBeta1.0.1\build\exploded-bundles\AplikaceBeta101ProjectLibrariesFacebookUnspecified.aar\res\drawable\com_facebook_profile_picture_blank_square.png -o C:\Users\David\Desktop\facebook-android-sdk-3.5\facebook-android-sdk-3.5\samples\AplikaceBeta1.0.1Project\AplikaceBeta1.0.1\build\res\all\debug\drawable\com_facebook_profile_picture_blank_square.png   错误code:       42   输出:       C:\Users\David\Desktop\facebook-android-sdk-3.5\facebook-android-sdk-3.5\samples\AplikaceBeta1.0.1Project\AplikaceBeta1.0.1\build\exploded-bundles\AplikaceBeta101ProjectLibrariesFacebookUnspecified.aar\res\drawable\com_facebook_profile_picture_blank_square.png错误:无法打开PNG文件

Gradle: Execution failed for task ':AplikaceBeta1.0.1:mergeDebugResources'. Failed to run command: C:\Users\David\AppData\Local\Android\android-studio\sdk\build-tools\android-4.2.2\aapt.exe s -i C:\Users\David\Desktop\facebook-android-sdk-3.5\facebook-android-sdk-3.5\samples\AplikaceBeta1.0.1Project\AplikaceBeta1.0.1\build\exploded-bundles\AplikaceBeta101ProjectLibrariesFacebookUnspecified.aar\res\drawable\com_facebook_profile_picture_blank_square.png -o C:\Users\David\Desktop\facebook-android-sdk-3.5\facebook-android-sdk-3.5\samples\AplikaceBeta1.0.1Project\AplikaceBeta1.0.1\build\res\all\debug\drawable\com_facebook_profile_picture_blank_square.png Error Code: 42 Output: C:\Users\David\Desktop\facebook-android-sdk-3.5\facebook-android-sdk-3.5\samples\AplikaceBeta1.0.1Project\AplikaceBeta1.0.1\build\exploded-bundles\AplikaceBeta101ProjectLibrariesFacebookUnspecified.aar\res\drawable\com_facebook_profile_picture_blank_square.png ERROR: Unable to open PNG file

无法打开PNG文件......什么?!

Unable to open PNG file... what?!

code是完全一样的<一个href="https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android-using-android-studio/3.0/">Getting入门Facebook的SDK为Android(安卓工作室)指南。这真的很简单,这是我的MainActivity.java:

Code is totally the same as in "Getting Started with the Facebook SDK for Android (Android Studio)" guide. It's really simple, this is my MainActivity.java:

package com.example.aplikacebeta101;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.widget.TextView;
import com.facebook.*;
import com.facebook.model.*;

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // start Facebook Login
        Session.openActiveSession(this, true, new Session.StatusCallback() {

            // callback when session changes state
            @Override
            public void call(Session session, SessionState state, Exception exception)             {
            if (session.isOpened()) {

                // make request to the /me API
                Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {

                    // callback after Graph API response with user object
                    @Override
                    public void onCompleted(GraphUser user, Response response) {
                        if (user != null) {
                            TextView welcome = (TextView) findViewById(R.id.welcome);
                            welcome.setText("Hello " + user.getName() + "!");
                        }
                    }
                });
            }
        }
    });
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
}

}

任何想法?我知道,Android的工作室仍然是EAP,但我认为这不是由Android的工作室造成的。

Any ideas? I know, Android Studio is still EAP, but I think this is not caused by Android Studio.

推荐答案

您使用的是Windows?如果生成的构建文件路径超过Windows的这个错误可能发生(的不是NTFS 的)的最大路径的 260 字符长度。确保你的项目路径不要太长,使用短的名称为好。从MS 更多信息:

Are you using Windows? This error could happen if the generated build file path exceeds the Windows (not NTFS) max path length of 260 characters. Make sure your project path is not too long, use short names as well. More info from MS:

最大路径长度限制   在Windows API(在下面的段落中讨论的一些例外),最大长度为一个路径是MAX_PATH,其被定义为260个字符。本地路径的编排顺序如下:驱动器盘符,冒号,反斜杠,名字组分分离用反斜杠,并终止空字符。例如,在驱动器D的最大路径为D:\有些256个字符的路径字符串,其中重presents当前系统codePAGE无形的终止空字符。 (字符&所述;>在这里使用的视觉清晰度,并且不能是有效的路径串的一部分)

Maximum Path Length Limitation In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters. A local path is structured in the following order: drive letter, colon, backslash, name components separated by backslashes, and a terminating null character. For example, the maximum path on drive D is "D:\some 256-character path string" where "" represents the invisible terminating null character for the current system codepage. (The characters < > are used here for visual clarity and cannot be part of a valid path string.)

另请参见<一href="http://stackoverflow.com/questions/1880321/why-does-the-260-character-path-length-limit-exist-in-windows">discussion为什么限制的Windows存在。

这篇关于Android的工作室 - 无法打开PNG文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆