2013-09-24 68 views
-1

我在Eclipse中有一個新的Android項目,一個活動和TextView,沒有別的。我沒有修改任何東西。當我嘗試我的手機上運行的USB應用(與Android 4.1.1中興V970M),我得到Eclipse:由於APK文件無效導致安裝失敗

在控制檯

Installation failed due to invalid APK file! 
Please check logcat output for more details. 
Launch canceled! 

在logcat的

09-24 12:21:01.174: D/dalvikvm(584): Not late-enabling CheckJNI (already on) 
09-24 12:21:01.854: E/Trace(584): error opening trace file: No such file or directory (2) 
09-24 12:21:02.684: D/gralloc_goldfish(584): Emulator without GPU emulation detected. 

PLS,幫助我找到解決辦法。順便說一句,AVD的所有作品。

我的.java

package com.example.testusbdebug; 

import android.os.Bundle; 
import android.app.Activity; 
import android.view.Menu; 

public class MainActivity extends Activity { 

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

    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     getMenuInflater().inflate(R.menu.main, menu); 
     return true; 
    } 

} 

我的.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=".MainActivity" > 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true" 
     android:text="@string/hello_world" /> 

</RelativeLayout> 

和我的清單

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.testusbdebug" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk 
     android:minSdkVersion="8" 
     android:targetSdkVersion="18" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name="com.example.testusbdebug.MainActivity" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 
+0

你見過[這](http://stackoverflow.com/questions/7998101/eclipse-installation-failed-due-to-invalid-apk-file)? – Androiderson

+0

你簽了你的apk嗎?我不記得,但是當我半年前開發了一個應用程序時,我不得不創建一個密鑰存儲並使用它簽署我的apk – JohnnyAW

+0

例外 - 是的,沒有幫助 – cherya

回答

相關問題