I can't build for android because of the error at the end of build process. Unity tries to execute D:/AndroidSDK\tools\bin\apkanalyzer.bat but there is no such file. apkanalyzer does not have .bat
Please submit a bug report with steps to reproduce and the project attached (could be a small one) and post the case number here. Thanks!
FYI: I've submitted a bug report to Google about the missing tool: https://issuetracker.google.com/issues/124064881
Jeez, it's a duplicate of a bug that exists from March, 19th, 2018 !!!! https://issuetracker.google.com/issues/75981301 I don't expect Google will fix it anytime soon... Edit: I tried a .bat I found online and it also didn't work. I also tried not using the builtin android sdk on unity 2019 and it also didn't work. @Yury-Habets is this apkanalyzer step important? It doesn't seem to happen on unity 2018, it's impossible to make a android build on windows with 2019. Edit2: I tried this bat : Code (CSharp): @echo off ::############################################################################## ::## ::## apkanalyzer start up script for Windows ::## ::## converted by ewwink ::## ::############################################################################## ::Attempt to set APP_HOME SET SAVED=%cd% SET APP_HOME=F:\Programs\Unity\2019.1.0f2\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools SET APP_NAME="apkanalyzer" ::Add default JVM options here. You can also use JAVA_OPTS and APKANALYZER_OPTS to pass JVM options to this script. SET DEFAULT_JVM_OPTS=-Dcom.android.sdklib.toolsdir=%APP_HOME% SET CLASSPATH=%APP_HOME%\lib\dvlib-26.0.0-dev.jar;%APP_HOME%\lib\util-2.2.1.jar;%APP_HOME%\lib\jimfs-1.1.jar;%APP_HOME%\lib\annotations-13.0.jar;%APP_HOME%\lib\ddmlib-26.0.0-dev.jar;%APP_HOME%\lib\repository-26.0.0-dev.jar;%APP_HOME%\lib\sdk-common-26.0.0-dev.jar;%APP_HOME%\lib\kotlin-stdlib-1.1.3-2.jar;%APP_HOME%\lib\protobuf-java-3.0.0.jar;%APP_HOME%\lib\apkanalyzer-cli.jar;%APP_HOME%\lib\gson-2.3.jar;%APP_HOME%\lib\httpcore-4.2.5.jar;%APP_HOME%\lib\dexlib2-2.2.1.jar;%APP_HOME%\lib\commons-compress-1.12.jar;%APP_HOME%\lib\generator.jar;%APP_HOME%\lib\error_prone_annotations-2.0.18.jar;%APP_HOME%\lib\commons-codec-1.6.jar;%APP_HOME%\lib\kxml2-2.3.0.jar;%APP_HOME%\lib\httpmime-4.1.jar;%APP_HOME%\lib\annotations-12.0.jar;%APP_HOME%\lib\bcpkix-jdk15on-1.56.jar;%APP_HOME%\lib\jsr305-3.0.0.jar;%APP_HOME%\lib\explainer.jar;%APP_HOME%\lib\builder-model-3.0.0-dev.jar;%APP_HOME%\lib\baksmali-2.2.1.jar;%APP_HOME%\lib\j2objc-annotations-1.1.jar;%APP_HOME%\lib\layoutlib-api-26.0.0-dev.jar;%APP_HOME%\lib\jcommander-1.64.jar;%APP_HOME%\lib\commons-logging-1.1.1.jar;%APP_HOME%\lib\annotations-26.0.0-dev.jar;%APP_HOME%\lib\builder-test-api-3.0.0-dev.jar;%APP_HOME%\lib\animal-sniffer-annotations-1.14.jar;%APP_HOME%\lib\bcprov-jdk15on-1.56.jar;%APP_HOME%\lib\httpclient-4.2.6.jar;%APP_HOME%\lib\common-26.0.0-dev.jar;%APP_HOME%\lib\jopt-simple-4.9.jar;%APP_HOME%\lib\sdklib-26.0.0-dev.jar;%APP_HOME%\lib\apkanalyzer.jar;%APP_HOME%\lib\shared.jar;%APP_HOME%\lib\binary-resources.jar;%APP_HOME%\lib\guava-22.0.jar SET APP_ARGS=%* ::Collect all arguments for the java command, following the shell quoting and substitution rules SET APKANALYZER_OPTS=%DEFAULT_JVM_OPTS% -classpath %CLASSPATH% com.android.tools.apk.analyzer.ApkAnalyzerCli %APP_ARGS% ::Determine the Java command to use to start the JVM. SET JAVACMD="java" where %JAVACMD% >nul 2>nul if %errorlevel%==1 ( echo ERROR: 'java' command could be found in your PATH. echo Please set the 'java' variable in your environment to match the echo location of your Java installation. echo. exit /b 0 ) :: execute apkanalyzer %JAVACMD% %APKANALYZER_OPTS% And it throws this error : Code (CSharp): stderr[ Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156) at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75) at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81) at com.android.tools.apk.analyzer.ApkAnalyzerCli.getAaptInvokerFromSdk(ApkAnalyzerCli.java:277) at com.android.tools.apk.analyzer.ApkAnalyzerCli.main(ApkAnalyzerCli.java:129) Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 5 more ] stdout[ ] exit code: 1 edit 3: When the command is ran from unity with my bat it throws the error: CommandInvokationFailure: F:\Programs\Unity\2019.1.0f2\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin\apkanalyzer.bat manifest version-code "G:/Projects/test/Builds/Android\testapk.armeabi-v7a.apk" But if I execute it manually in command prompt it apparently works and returns the apk version 100001. edit 4: I tested on another project and it doesn't run apkanalyzer, same unity version, what is this? How can we skip this step?
The only way I got it to work was to make my own hacked bat file Code (CSharp): @echo off ECHO 100001 change 100001 to whatever is the version you want to Build and run...
That file is a unix shell script. Doesn't work on windows. The bat I posted above should work, it runs nice when I execute with command prompt, but unity fails to make it work and I couldn't figure out why. I also can't understand why Unity runs the analyzer in one project and not on the other.
Unfortunately we're reverting back to using AAPT instead of apkanalyzer for now. Apkanalyzer from SDK build-tools v29 seems to work; the tools currently in beta, when they get released, we may revert to using apkanalyzer again.