Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Unable to install APK

Discussion in 'Android' started by nikon, Sep 18, 2011.

  1. nikon

    nikon

    Joined:
    Sep 18, 2011
    Posts:
    4
    Hi everyone,

    I am developing in Windows 7 and I would like to deploy/publish my game onto my android phone (HTC Evo 4G).

    I've installed the Android Development Kit, HTC Evo 4G USB Drivers / HTC Sync, and I am currently using Unity 3D.

    The phone is running OS 2.3.3 Gingerbread.

    The message that I am getting is:

    "Unable to install APK.
    protocol failure.

    UnityEngine.Debug:LogError(Object)
    PostProcessAndroidPlayer:UploadAndStartPlayer(String, String, String, String, String, Boolean, Single, Single, Boolean) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/BuildPipeline/PostProcessAndroidPlayer.cs:826)
    PostProcessAndroidPlayer:postProcess(BuildTarget, String, String, String, String, String, String, BuildOptions) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/BuildPipeline/PostProcessAndroidPlayer.cs:403)
    "

    I am really not sure what the problem is. Observations:

    1) It usually stays on the screen "Pushing new content to device ........... " for a long time until the error message shows up in the console.

    It also sometimes shows the following message for a long time "Requesting OS Configuration data from device...."

    2) I am using Gingerbread 2.3.3, which seems to show up in the SDK Manager. It is under Installed Packages:

    SDK Platform Android 2.3.3, API 10, revision 2

    3) When it asks for the directory to save the APK file after clicking on Build and Run, do we select a folder on our desktop or in a folder on the phone?

    4) Before clicking Build and Run, here are the player settings:

    Bundle Id: com.androidtest.greenAndroid
    Bundle Version: 1.0
    Bundle Version Code: 1

    API Level: Android 2.3.3 (API Level 10)
    Device Filter: ARMv7 only
    Graphics Level: OpenGL ES 1.x

    Api Compatibility Level: .NET .20 Subset
    Stripping Level* : Strip ByteCode (iOS only)


    Thanks in advance.
     
    Last edited: Sep 18, 2011
  2. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,058
    I also get the "requesting os configuration data from device" error sometimes, but this is usually due to the Evo crashing or freezing.

    Except when it's the case that Unity has apparently done a massive memory leak. Reboot...
     
    Last edited: Mar 14, 2012
  3. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,632
    If you use the "Build Setting" option from the file menu and select "Build" instead of "Build Run" you will get a file save dialog and you can get your .apk as a file. Which you can then transfer to the device (use some file explorer to run) or upload to ftp (use the browser to download).

    This will tell us that at least it can build the .apk and the device can play it so we can rule out settings in Unity and only focus on the Device drivers etc.
     
  4. AdamOwen

    AdamOwen

    Joined:
    Jul 13, 2011
    Posts:
    66
    Just to rule something else out, have you checked the "Unknown sources" box in Settings > Applications on your device?
     
  5. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,632
    Yes, this too.
     
  6. Moredice_legacy

    Moredice_legacy

    Joined:
    Jan 31, 2010
    Posts:
    101
    Did you also set your phone to USB Debugging/Development Mode?
     
  7. Zbigniew Wiadro

    Zbigniew Wiadro

    Joined:
    Aug 20, 2013
    Posts:
    6
    I had the same problem and found a solution (it works for me):

    PlayerSettings->Settings for Android -> Install Location: change from "Prefer External" to "Automatic".
     
    Alex_Designer likes this.
  8. Binbag42

    Binbag42

    Joined:
    Apr 14, 2014
    Posts:
    6
    I ran in he same problem but none of the solutions solved my problem. What seems to have worked is to free up space on my device. I had roughly 300MB left on my internal memory for a 43MB APK. Hope this can help somebody.
     
  9. mitaywalle

    mitaywalle

    Joined:
    Jul 1, 2013
    Posts:
    245
    Hello comrades. I wouldn't start new thread, I've same error.

    -Android SDK, JDK & JRE are up-to-date

    -Tried on different devices - have the same result.

    -Devices are in usb debugging mode.

    -Free space more then enough

    -Install location is auto

    -No apps with the same name on device

    -Tried on Samsung G350 & Samsung sm t231

    -Earlier it worked with this manifest

    Plugins used for android:

    -AdColony.
    https://github.com/AdColony/AdColony-Unity-SDK
    it's recommended manifest:


    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.jirbo.unitytest"
    android:versionCode="1"
    android:versionName="1.0">
    <!-- TODO: Replace the 'package' value above to reflect your app's package id. -->

    <!-- NOTE: Adjust minSDKVersion and targetSdkVersion as desired. -->
    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />

    <!-- NOTE: You must have at least these four permissions for AdColony. -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application android:label="@String/app_name"
    android:icon="@drawable/app_icon"
    android:hardwareAccelerated="true">
    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:label="@String/app_name">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>

    <!-- <meta-data android:name="unityplayer.UnityActivity" android:value="true" /> -->
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik"
    android:value="true" />
    </activity>

    <!-- NOTE: You must include these three activity specifications for AdColony. -->
    <activity android:name="com.jirbo.adcolony.AdColonyOverlay"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.jirbo.adcolony.AdColonyFullscreen"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
    <activity android:name="com.jirbo.adcolony.AdColonyBrowser"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
    <activity android:name="com.outlinegames.unibill.PurchaseActivity"
    android:label="@String/app_name"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    </application>
    </manifest>



    -GameAnalitycs.
    https://github.com/GameAnalytics/GA-SDK-UNITY-LEGACY
    It's manifest:


    s (20 sloc) 1.68 KB

    <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.GameAnalytics.AndroidTest" android:theme="@android:style/Theme.NoTitleBar" android:versionName="1.0" android:versionCode="1" android:installLocation="preferExternal"> <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" /> <application android:icon="@drawable/app_icon" android:label="@String/app_name" android:debuggable="false"> <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@String/app_name" android:screenOrientation="portrait" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <meta-data android:name="unityplayer.UnityActivity" android:value="true" /> <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" /> </activity> <meta-data android:name="com.google.android.gms.version" android:value="4030500" /> </application> <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19" /> <uses-feature android:glEsVersion="0x00020000" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> </manifest>



    And here's my result manifest.


    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.roonto.horror_free"
    android:versionCode="1"
    android:versionName="1.0">
    <supports-screens
    android:smallScreens="true"
    android:normalScreens="true"
    android:largeScreens="true"
    android:xlargeScreens="true"
    android:anyDensity="true"/>
    <!-- TODO: Replace the 'package' value above to reflect your app's package id. -->
    <!-- NOTE: Adjust minSDKVersion and targetSdkVersion as desired. -->
    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
    <!-- NOTE: You must have at least these four permissions for AdColony. -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <application android:label="@String/app_name" android:icon="@drawable/app_icon" android:hardwareAccelerated="true">
    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:label="@String/app_name">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <!-- <meta-data android:name="unityplayer.UnityActivity" android:value="true" /> -->
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
    </activity>
    <!-- NOTE: You must include these three activity specifications for AdColony. -->
    <activity android:name="com.jirbo.adcolony.AdColonyOverlay"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.jirbo.adcolony.AdColonyFullscreen"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
    <activity android:name="com.jirbo.adcolony.AdColonyBrowser"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />

    </application>
    </manifest>






    Here's error log

    Installation failed with the following output:
    pkg: /data/local/tmp/Package.apk
    Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]
    5987 KB/s (61164672 bytes in 9.976s)

    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

    UnityException: Unable to install APK!
    Installation failed. See the Console for details.
    UnityEditor.Android.PostProcessAndroidPlayer.ShowErrDlgAndThrow (System.String title, System.String message, System.Exception ex)
    UnityEditor.Android.PostProcessAndroidPlayer.ShowErrDlgAndThrow (System.String title, System.String message)
    UnityEditor.Android.PostProcessAndroidPlayer.UploadAndStartPlayer (System.String manifestName, System.String stagingArea, UnityEditor.Android.AndroidDevice device, System.String packageName, Boolean devPlayer, Boolean retryUpload)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
     
    Last edited: Sep 21, 2015
  10. DevOwen

    DevOwen

    Joined:
    Jan 13, 2016
    Posts:
    1
    I were facing the same issue today and fix it by rename the android package name.

    It seems like the android device I were using has an older version app installed and unity cannot overwrite the old version for some reason.

    I hope this can help some of you,
     
  11. DisposableHero70

    DisposableHero70

    Joined:
    Jan 20, 2015
    Posts:
    1
    @DevOwen - YES THANKS for suggesting to UNINSTALL the app from the phone. This fixed my problem of a 'new' APK file failing to re-install over my existing game install. I used to simply re-install an updated APK file from my old Dev environment as many times as I liked - without needing to un-install. I changed my development environment to Win 10, latest version of Unity(free), Android studio etc., and then the installation would FAIL. I thought it was my new dev env not configured right, but it just needed a completely fresh install...
     
  12. Alex_Designer

    Alex_Designer

    Joined:
    Jul 29, 2016
    Posts:
    1
    Thanks a lot for the tip! It works like a charm :)
     
  13. TheOtherJoJo

    TheOtherJoJo

    Joined:
    Apr 5, 2015
    Posts:
    14
    I got the problem when I was building a new project to create a test file for a facebook implementation.
    When I got the implementation finished I installed it on my device to test it. I then decided to export it as an unity package.

    I then imported that package into my main project, made the necessary changes, and when I went to build and run, I got the 'Unable to install apk' error.

    What worked for me was to uninstall the test project from the device and that allowed my main project to install on the device.
    I don't know what conflicted with it because the test project had a different package name but it shared the same facebook app id. Maybe that was it.
     
    MGGDev likes this.