eclipse 由于 URI 无效,安装失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17769496/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 20:55:28  来源:igfitidea点击:

Installation failed due to an invalid URI

javaandroideclipse

提问by Little Child

[2013-07-21 11:14:01 - AndroidTrial] Installation failed due to invalid URI!
[2013-07-21 11:14:01 - AndroidTrial] Please check logcat output for more details.
[2013-07-21 11:14:02 - AndroidTrial] Launch canceled!  

This is what I get when I try to run a trial project. There is no output in the logcat.
I looked at other answer on SO for similar problems and they say that it can be because of accented characters. I do not have any of those.

这就是我尝试运行试验项目时得到的结果。logcat 中没有输出。
我查看了关于类似问题的其他答案,他们说这可能是因为重音字符。这些我都没有。

Here is what my simple code looks like:

这是我的简单代码的样子:

public class HaikuDisplay extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    public void onTrialButtonClicked(View view){
        TextView v = (TextView) findViewById(R.id.text);
        v.setVisibility(View.VISIBLE);
    }

}  

And here is the XML:

这是 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=".HaikuDisplay" >
    <Button 
        android:id="@+id/topBtn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/love_button_text"
        android:onClick="onTrialButtonClicked"
        />
    <TextView
        android:layout_below="@id/topBtn"
        android:id="@+id/text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" 
        android:visibility="invisible"/>

</RelativeLayout>  

how do I solve that?

我该如何解决?

回答by Warpzit

This error can point to so many different things, and there is many different fixes. To sum those I've gathered:

这个错误可以指向很多不同的东西,并且有很多不同的修复方法。总结一下我收集的那些:

  1. Problems with Eclipse:Clean project, rebuild project, restart eclipse.
  2. Invalid characters:Remove any special characters in Eclipse project name. Use only [a-z] and [0-9] not even [ ] (whitespace)
  3. Error in included jar:Try without jar and see if it runs, if does fix somehow.
  4. Errors in manifest package setup:Right click in eclipse on project -> Android tools-> Rename application package(rename to something similar, you can always rename back).
  5. Problems with device:Remove app from device and try re install.
  6. Rom issue:If you use custom ROM try to reflash to a new ROM.
  7. Debugging not enabled:On phone go to Settings-> Applications-> Allow unknown sources/enable debugging(this path can vary for different devices)
  1. Eclipse 的问题:清理项目,重建项目,重新启动 Eclipse。
  2. 无效字符:删除 Eclipse 项目名称中的所有特殊字符。仅使用 [az] 和 [0-9] 甚至不使用 [ ](空格)
  3. 包含的 jar 中的错误:尝试不使用 jar 并查看它是否运行,如果确实以某种方式修复。
  4. 清单包设置中的错误:在 Eclipse 中右键单击项目 -> Android tools-> Rename application package(重命名为类似的名称,您可以随时重命名)。
  5. 设备问题:从设备中删除应用程序并尝试重新安装。
  6. Rom 问题:如果您使用自定义 ROM,请尝试刷新到新 ROM。
  7. 未启用调试:在手机上转到Settings-> Applications-> Allow unknown sources/enable debugging(此路径可能因设备而异)

回答by Juri

In my case the problem was the Android project name as it contained German umlauts: ?ü?... I refactored the name and it worked.

在我的情况的问题是因为它包含德国变音的Android项目名称:?ü..。我重构了这个名字,它奏效了。

回答by live-love

In my case it was because I had changed the name of my app the strings.xml file:

就我而言,这是因为我更改了应用程序的名称,即 strings.xml 文件:

<string name="app_name">My App</string>

Removing the app and reinstalling it solved the problem.

删除应用程序并重新安装它解决了问题。