Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Last active April 29, 2024 19:32
Show Gist options
  • Save unitycoder/6b6410800727548afaf9b0043121a164 to your computer and use it in GitHub Desktop.
Save unitycoder/6b6410800727548afaf9b0043121a164 to your computer and use it in GitHub Desktop.
Unity Android Build Errors
### "error while evaluating property namespace of task unitylibrary:googleplaygamesmanifest.androidlib:packageReleaseResources'
Delete "Assets\Plugins\Android\GooglePlayGamesManifest.androidlib" folder before build (every time)
### get your app id from google play console (for leaderboards plugin)
- On the left menu, Play Games Services/Setup and management/Configuration (but its only available, if you have done play services setup for this app)
### GRADLE ERROR : colliding-attributes
- https://gley.gitbook.io/easy-achievements/setup-guide#build
### stuck at "building scene 0"
- adjust Assets > Dependency Manager > android resolver > Settings
- Disable enable auto-resolution
- Disable Enable resolution on build
- Disable Auto resolution dialog
- solution from here https://stackoverflow.com/a/77648750/5452781
### stuck at "build gi data"
- disable automatic baking from Lighting settings bottom, then press bake manually
- or clear gi cache
how to decode android crash logs / crash stack trace
- You need to use a tool called ‘addr2line’ from the Android NDK https://developer.android.com/ndk/downloads/index.html
- Running the tool is done like so: addr2line -Cfe
- Unity symbol files are found under the Unity installation path: <Unity>\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\mono\Release\Symbols
- Once the tool was launched, you can start inputting memory addresses, and it will output the function name
- https://www.li0rtal.com/decode-unity-crashes-android/
slow build from commandline
- dont use default compression?
app crashes on tablet (works on phone)
- see log, device starts running out of memory, so ActivityManager starts killing other activities
https://forum.unity.com/threads/unity-game-works-on-android-phone-but-not-on-android-tablet.1163863/
-----------
> * What went wrong:
Execution failed for task ':launcher:signReleaseBundle'.
> 1 exception was raised by workers:
java.lang.RuntimeException: jarsigner.exefailed with exit code 1 :
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
> WARNING: The option setting 'android.bundle.enableUncompressedNativeLibs=false' is experimental and unsupported.
The current default is 'true'.
> Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings
Execution failed for task ':launcher:packageRelease'.
> 1 exception was raised by workers:
java.lang.RuntimeException: com.android.ide.common.signing.KeytoolException: Failed to read key woodchop from store "****\Keys\user.keystore": Cannot recover key
debug key build works,
creating new key works..(password is correct)
------------
> missing sdk 30
use commandline to download 30 (unity 2019.4 manages to update it from that dialog)
sdk\Android\android-sdk\tools\bin\sdkmanager.bat ..SOMETHINGHERE..
> open android native file manager
https://forum.unity.com/threads/how-to-open-native-file-manager.1129915/
> Get file size of local StreamingAssets file on Android
There is no easy way to do that.
The only way to get the size of file in StreamingAssets on Android is to read the header of the zip file (apk or obb).
https://forum.unity.com/threads/get-file-size-of-local-streamingassets-file-on-android.1123825/#post-7225531
--------
remove app from recent apps:
o remove app from recent you just have to add
android:autoRemoveFromRecents="true"
to AndroidManifest.xml in <activity> tag.
Then Application.Quit(); will quit the app and it will be removed from recent list.
https://forum.unity.com/threads/remove-app-from-recent.325525/#post-7214161
// https://forum.unity.com/threads/remove-app-from-recent.325525/#post-7214161
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.app.app" android:versionCode="1" android:versionName="1.0">
  <application android:label="@string/app_name" android:icon="@drawable/app_icon">
    <activity android:name="com.google.firebase.MessagingUnityPlayerActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:autoRemoveFromRecents="true">
      <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" />
    </activity>
    <service android:name="com.google.firebase.messaging.MessageForwardingService" android:exported="false" />
  </application>
</manifest>
-----------
build and run:
"Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]]stdout[Performing Streamed Install]"
enable install from ubs in the device (developer settings)
---------
manually install missing sdk version
"C:\Program Files 2\2019.4.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin\sdkmanager.bat" "platforms;android-28"
// https://forum.unity.com/threads/android-sdk-does-not-include-your-target-sdk-of-28.1002894/#post-6508023
-----------
wrong NDK 19 version
manually edit version from ndk settings file:
https://issuetracker.unity3d.com/issues/unity-hub-android-ndk-integrated-ndk-version-is-not-compatible-with-available-unity-hub-or-android-developer-ndk-versions
-------------
PROBLEM
WebException: Error: NameResolutionFailure
(happens with il2cpp build)
SOLUTION
Select [x] internet access required in build settings
-------------
PROBLEM
build and run: Android device is not responding
adb devices shows it unauthorized
SOLUTION
unpluck and pluck again, click allow debugging
---------------
PROBLEM
Failed to extract Android SDK Platform version from string 'Q',
Input string was not in a correct format.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
SOLUTION
Build still works, probably too new phone model?
--------------------------------------------------------
PROBLEM
CommandInvokationFailure: Failed to update Android SDK package list.
x:/sdk/Android/android-sdk\tools\bin\sdkmanager.bat --list
SOLUTION
if have tools.backup folder:
rename tools/ to tools.broken/
rename tools.backup/ to tools/
---------------------------------------------------------
PROBLEM
forgot keystore password
SOLUTION
use bruteforce tool (link)
or try guess within editor:
- first browse keystore file
- then enter password there, then try to select key below, if wrong pwd cannot select (faster to test than building)
----------------------------------------------------
PROBLEM
Cannot download old sdk gui tool, without complete android studio
SOLUTION
old archive version, run sdk manager updates after unzipping
https://www.dropbox.com/s/aqze528vj59ka7i/android-sdk-with-sdk-manager.7z?dl=0
-----------------------------------------------
ERROR
OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_ENUM: enum argument out of range
(Filename: /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 335)
SOLUTION
Dont play video too early, Prepare first.
But still gives error after playing when isPrepared == true
----------------------------------------------
ERROR
[EGL] Unable to acquire context: EGL_BAD_ALLOC: EGL failed to allocate resources for the requested operation.
11-26 20:35:04.060 12329 12350 E Unity :
11-26 20:35:04.060 12329 12350 E Unity : (Filename: /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/egl/WindowContextEGL.cpp Line: 267)
SOLUTION
Disable [ ] multithreaded rendering
----------------------------------------------
I've learned that you can symbolicate the libil2cpp.so frames using the ndk-stack utility: https://developer.android.com/ndk/guides/ndk-stack
The debug symbols are in a .zip file next to the generated .apk. You should be able to extract that file, then use ndk-stack to determine the missing frames in that call stack.
https://forum.unity.com/threads/sigabrt-crash-soon-after-app-launch.531665/#post-3498831
----------------------------------------------
ERROR
UMP player crashes if vr mode is enabled
I/DEBUG ( 370): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 370): Build fingerprint: 'samsung/ks01ltexx/ks01lte:5.0.1/LRX22C/I9506XXUDOK1:user/release-keys'
I/DEBUG ( 370): Revision: '15'
I/DEBUG ( 370): ABI: 'arm'
I/DEBUG ( 370): pid: 12465, tid: 12556, name: Thread-36020 >>> com.edu2vr.localstreamplayer <<<
I/DEBUG ( 370): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x382c206e
I/DEBUG ( 370): r0 382c200a r1 00100007 r2 9dedda50 r3 00000000
I/DEBUG ( 370): r4 9dedda50 r5 9e001780 r6 9e001780 r7 00000078
I/DEBUG ( 370): r8 004f8a74 r9 ad24d2d0 sl 9e5f8ab4 fp ad256e40
I/DEBUG ( 370): ip 9a0fa900 sp 9e001768 lr 9a08df6d pc 99fc0af8 cpsr 60070030
I/DEBUG ( 370):
I/DEBUG ( 370): backtrace:
I/DEBUG ( 370): #00 pc 0001daf8 /data/app/com.edu2vr.localstreamplayer-2/lib/arm/libgvr.so
I/DEBUG ( 370): #01 pc 000eaf69 /data/app/com.edu2vr.localstreamplayer-2/lib/arm/libgvr.so
I/DEBUG ( 370): #02 pc 000b73e7 /data/app/com.edu2vr.localstreamplayer-2/lib/arm/libgvr.so
I/DEBUG ( 370): #03 pc 00033047 /data/app/com.edu2vr.localstreamplayer-2/lib/arm/libgvr.so
I/DEBUG ( 370): #04 pc 000330ab /data/app/com.edu2vr.localstreamplayer-2/lib/arm/libgvr.so
I/DEBUG ( 370): #05 pc 0002c3eb /data/app/com.edu2vr.localstreamplayer-2/lib/arm/libgvr.so
I/DEBUG ( 370): #06 pc 009f6d7c /data/app/com.edu2vr.localstreamplayer-2/lib/arm/libunity.so
I/DEBUG ( 370): #07 pc 009eaf40 /data/app/com.edu2vr.localstreamplayer-2/lib/arm/libunity.so
I/DEBUG ( 370): #08 pc 00565c7c /data/app/com.edu2vr.localstreamplayer-2/lib/arm/libunity.so
I/DEBUG ( 370): #09 pc 00566a9c /data/app/com.edu2vr.localstreamplayer-2/lib/arm/libunity.so
I/DEBUG ( 370): #10 pc 00560904 /data/app/com.edu2vr.localstreamplayer-2/lib/arm/libunity.so
I/DEBUG ( 370): #11 pc 003cfa10 /data/app/com.edu2vr.localstreamplayer-2/lib/arm/libunity.so
I/DEBUG ( 370): #12 pc 000137b3 /system/lib/libc.so (__pthread_start(void*)+30)
I/DEBUG ( 370): #13 pc 00011893 /system/lib/libc.so (__start_thread+6)
I/DEBUG ( 370):
I/DEBUG ( 370): Tombstone written to: /data/tombstones/tombstone_04
SOLUTION
Disable multithreaded rendering
----------------------------
ERROR
I/Unity ( 1556): Could not recreate VR window because GfxDevice is in an invalid state (device lost)
I/Unity ( 1556):
I/Unity ( 1556): (Filename: Line: 850)
SOLUTION
???????
----------------------------
ERROR
cardboard app shows black screen
E/Unity (29419): OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_FRAMEBUFFER_OPERATION: Framebuffer is not complete or incompatible with command
E/Unity (29419):
E/Unity (29419): (Filename: ./Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 388)
SOLUTION
?????
Enable multithreading?
--------------------
ERROR
cardboard app crashes or shows black/white screen
logcat:
W/ActivityManager( 1029): Unable to start service Intent { act=com.google.vr.vrcore.controller.BIND pkg=com.google.vr.vrcore } U=0: not found
SOLUTION
???
----------------------
ERROR
Installation failed with the following output:
[ 0%] /data/local/tmp/player.apk
[ 0%] /data/local/tmp/player.apk
[ 0%] /data/local/tmp/player.apk
[ 0%] /data/local/tmp/player.apk
SOLUTION
Set lower API level in build settings
----------------------
ERROR
CommandInvokationFailure: Failed to build apk. Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Encoder
SOLUTION
Dont use JAVA9, use 8
http://answers.unity3d.com/questions/1415655/android-apk-build-failed-error-how-do-i-fix-this.html
----------------------
ERROR
CommandInvokationFailure: Failed to re-package resources.
***\android-sdk\build-tools\25.0.2\aapt.exe package --auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I "***android-sdk\platforms\android-23\android.jar" -F bin/resources.ap_ --extra-packages com.google.vr.cardboard:com.unity3d.unitygvr -S "***Game\Temp\StagingArea\android-libraries\gvr\res" -S "***Game\Temp\StagingArea\android-libraries\unitygvr\res"
stderr[
AndroidManifest.xml:5: error: Error: String types not allowed (at 'configChanges' with value 'mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density').
]
SOLUTION
Tried updating JDK1.7.9 or older 1.8.0, uninstalled them, installed version JDK8 (JDK9 doesnt work), restart unity.
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
but didnt help, then solution was
run SDK Manager, install API 26 SDK Platform tools, i had API 23 installed..
----------------
PROBLEM
build size
SOLUTION
remove vulcan from graphics apis: (saves space)
https://forum.unity.com/threads/google-play-shows-app-only-on-3000-over-13k-devices-on-which-the-game-should-run-just-fine.775841/#post-5170550
--------------------
PROBLEM
"Shader error in 'Hidden/PostProcessing/FinalPass': Input signature parameter (1-based Entry 3) type must be a scalar uint. at line 44 (on gles)"
SOLUTION
remove opengls2.0 from automatic graphics API list
---------------------
PROBLEM
FormatException: Input string was not in a correct format.
at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal)
SOLUTION
Need to unplug android and plug back, if you had upgraded android while it was connected
----------------
PROBLEM
Unity Keystore Not Accepting Correct Password
SOLUTION (maybe)
https://forum.unity.com/threads/unity-keystore-not-accepting-correct-password.629329/#post-9528544
@unitycoder
Copy link
Author

@unitycoder
Copy link
Author

if need to install google play AR services without google login:
https://www.apkmirror.com/

@ahmedaniss25
Copy link

Problem fixed here : https://youtu.be/s4lz7ilPyyA

@unitycoder
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment