小编Bri*_*ijD的帖子

错误:任务':app:dexDebug'的执行失败

我试图在Android Studio for Mac中的模拟器中添加Google地图服务.我用在我的模拟器中添加谷歌播放服务,现在我收到此错误.

我还在"libs"中添加了Google play jar

构建错误

Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
            /Applications/Android Studio.app/sdk/build-tools/21.0.0/dx --dex --num-threads=4 --output /Users/BrijD/Desktop/Final_maps/app/build/intermediates/dex/debug /Users/BrijD/Desktop/Final_maps/app/build/intermediates/classes/debug /Users/BrijD/Desktop/Final_maps/app/build/intermediates/dependency-cache/debug /Users/BrijD/Desktop/Final_maps/app/build/intermediates/pre-dexed/debug/classes-0fd5fdfe526893278be8c195ce134eaf1d9f1e86.jar /Users/BrijD/Desktop/Final_maps/app/build/intermediates/pre-dexed/debug/classes-1c1ab6ce82c35aba8a1d88f2624cf1338444a247.jar /Users/BrijD/Desktop/Final_maps/app/build/intermediates/pre-dexed/debug/classes-3fa4a9ac8fa2216bad3a7f16c9a774b0dc355d43.jar /Users/BrijD/Desktop/Final_maps/app/build/intermediates/pre-dexed/debug/classes-8f6dc1447c1249308d36a8f93d1adf33837f8664.jar /Users/BrijD/Desktop/Final_maps/app/build/intermediates/pre-dexed/debug/internal_impl-21.0.0-fd4beb3682904051af27f723f6ba9423e4f00b8a.jar /Users/BrijD/Desktop/Final_maps/app/build/intermediates/pre-dexed/debug/support-annotations-21.0.0-ee576f91b45a6538d4156fc6e674b6f65034f74e.jar
          Error Code:
            2
          Output:
            UNEXPECTED TOP-LEVEL EXCEPTION:
            com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/actions/ReserveIntents;
                at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
                at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
                at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
                at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
                at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
                at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
                at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
                at com.android.dx.command.dexer.Main.run(Main.java:245)
                at com.android.dx.command.dexer.Main.main(Main.java:214)
                at com.android.dx.command.Main.main(Main.java:106)
Run Code Online (Sandbox Code Playgroud)

AndroidMainefest.xml

<?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="dormroomdevelopers.final_maps" >

        <uses-permission android:name="android.permission.INTERNET"/>
        <application
            android:allowBackup="true" …
Run Code Online (Sandbox Code Playgroud)

debugging android-studio android-gradle-plugin

3
推荐指数
1
解决办法
1万
查看次数

从android中的图库中获取图像

我一直在尝试从这个应用程序中的图库中获取图像,然后在按钮上单击我要上传到我的PHP服务器.

"selectedImagePath"为null为什么?如果有人有解决方案,请帮助我!提前致谢.

的onCreate()

img = (ImageView) findViewById(R.id.ImageView01);
        Button browse = (Button) findViewById(R.id.Button01);

        browse.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setType("image/*");
                intent.setAction(Intent.ACTION_GET_CONTENT);
                startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE);
            }
        });
Run Code Online (Sandbox Code Playgroud)

onActivityResult()

public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == RESULT_OK) {
            if (requestCode == SELECT_PICTURE) {
                selectedImageUri = data.getData();
                System.out.println(selectedImageUri);
                selectedImagePath = getPath(selectedImageUri);//returns as null
                System.out.println("Image Path : " + selectedImagePath);
                img.setImageURI(selectedImageUri);
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

的getPath()

public String getPath(Uri uri) {
        String[] …
Run Code Online (Sandbox Code Playgroud)

android android-intent android-gallery

1
推荐指数
1
解决办法
3820
查看次数