首页 > 第一次运行android时apk生成不成功

第一次运行android时apk生成不成功

这是我的第一个 android程序,下面是 错误信息
忘了告诉你们了,我是在android模拟器下运行的,没有用手机跑

[2014-08-21 00:00:28 - test] ------------------------------
[2014-08-21 00:00:28 - test] Android Launch!
[2014-08-21 00:00:28 - test] adb is running normally.
[2014-08-21 00:00:28 - test] Performing com.example.test.MainActivity activity launch
[2014-08-21 00:00:28 - test] Uploading test.apk onto device '94488e54'
[2014-08-21 00:00:28 - test] Installing test.apk...
[2014-08-21 00:00:29 - test] Installation error: INSTALL_CANCELED_BY_USER
[2014-08-21 00:00:29 - test] Please check logcat output for more details.
[2014-08-21 00:00:29 - test] Launch canceled!

这是代码

    <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="com.example.test.MainActivity" >



<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="姓名" 
    android:textSize="28sp"

    />

<EditText
    android:id="@+id/editText1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/textView1"
    android:layout_alignParentRight="true"
    android:layout_marginRight="17dp"
    android:ems="10"
    android:hint="请输入姓名" />


根据控制台的报的错误来看,可以肯定的是安装不成功肯定不是你代码的问题。你按照以下顺序检查一下你的测试机:
1.首先确保你的手机已经开启开发者模式,还有,有些手机需要手动点击确认安装才可以。
2.在手机上,勾选 系统设置->安全->未知来源选项后重试(这个错误小米手机很常见)。
3.安装的时候是否处于手机锁屏状态?如果是,取消锁屏。
4.虽然你的测试程序很小,但是还是要确认一下,你的手机内存是否还够用?可以适当卸载一些程序。
如果试了以上方法还是不行,可以把logcat日志贴出来看一下。


apk生成成功了,但是安装的时候被你取消了。切换到DDMS视图看下手机是否被正确识别。
如果已经被正确识别的话,安装apk的时候看看手机上是否需要手动确认安装(小米3是需要手动确认的)

【热门文章】
【热门文章】