简体   繁体   中英

Android: developed application works in emulator but not getting installed in my device

I'm trying to develop my first Android application. The application runs perfectly on my Eclipse Emulator. But when I create a Unsigned .apk file and copy it to my android phone for installing, its not getting installed. The message just says application is not installed and I couldn't see any error log messages.

How can I install an android app or to figure out what's going wrong?

Here's my setup: Android SDK 1.4 - Device target Android 2.1-update1 - Windows XP.

My Android Manifest file:

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

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="7" />
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Dashboard" 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>

Connect your phone to your computer using usb and make sure enable usb debugging is checked in your settings in your phone.

Right click on your project and choose debug as android application, and choose your phone in the device picker. If it automatically starts an emulator when you do this. Right click and choose debug configurations and choose manual (so it always gives you a chooser dialog for the device/emulator).

After signing the application with a debug key, it was installed without an issue. Thanks to Heiko Rupp for the answer.

First most important thing is that the App should be Signed.

Secondly make sure that you have made the changes in the xml file in the Lay Android has 4 Layouts (most of us know)

Layout Layout-small Layout-large Layout-xlarge

The issue with me was that I made the change in the XML file in the layout-small folder which supports 2.7 inches. I ran the Emulator which was again for 2.7 inches and worked absolutely fine. Now when I exported the signed application and tested in the device, it fails. The reason was that I did not make the necessary changes in the Layout folder. My device was expecting some fields for the calculation that was in the main.xml file but not in the version installed. So couple of things you should do. 1) When testing the application, do create only 1 folder (layout with all the xml files) and that way you will be able to test the FUNCTIONALITY of your app on all devices. 2) if you have created all the Layout folders and then make change in any XML file, do make sure that the change(s) is(are) cascaded to all folders.

Happy development...

If you Run [as android app] from Eclipse, it automatically generates a key and signs your app before it is uploaded. You should be able to choose your Device in the dialog box.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM