I am currently trying to build a game for Android, but there are (as of yet) two errors popping up:
A. When I just hit build, it says ‘Failed to re-package resources…’ as soon as it tries to update it with the player settings.
(package -v -f -m -J gen -M AndroidManifest.xml -S “res” -I “C:/Program Files (x86)/Android SDK/platforms/android-16\android.jar” -F bin/resources.ap_) …there should be a backslash before android.jar (as opposed to all the slashes in the path), but Answers seems to not want to display it
B. When I hit build&run, Unity tells me that it doesn’t find an Android device, although Unity Remote works perfectly well with the connected tablet.
This is the first time I try to build for android, so I might be missing something fundamental…
I installed the Android SDK today (API 16), if that is important. The device is a HTC Flyer.
You should find some helpful hints here:
Maybe problem ‘A’ has to do with the Texture Compression option in the build settings, because that’s when Unity edits the AndroidManifest. See also:
Regarding problem ‘B’: In order for your device to communicate with Unity to enable you to Build&Run you must run adb from the command line as follows:
- Open Command Prompt and navigate to the …\Android SDK\Platform-Tools folder, where you will find adb.exe
- type adb start-server (to ensure that the adb server is running)
- type adb devices to check that your device is communicating with the PC. This command should give you a code, serial or something else identifying your device
- After you successfully build your package with name filename.apk, you type adb install filename.apk. This will install the package to your device. To make things easy, copy your filename.apk in the same directory as adb, unless you want to set PATH, or give the full path to filename.apk in your adb install command.
If you perform steps 1,2,3 you will also be able to run successfully Build&Run from Unity, which effectively automatically performs steps 4 for you, and also starts the application in the device.