Hi World App is running in simulator but not generating the BUILD files.
I am getting this error
goBlank:
testFail:
setupJavac:
jar:
[echo] Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller
[echo] code size and wider device support
[copy] Copying 1 file to E:\rainforest\rfl1\rfl1-1\testcodenameone\build\tmp
[javac] E:\rainforest\rfl1\rfl1-1\testcodenameone\build.xml:131: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 3 source files to E:\rainforest\rfl1\rfl1-1\testcodenameone\build\tmp
[jar] Building jar: E:\rainforest\rfl1\rfl1-1\testcodenameone\dist\testcodenameone.jar
[javac] E:\rainforest\rfl1\rfl1-1\testcodenameone\build.xml:155: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
BUILD FAILED
E:\rainforest\rfl1\rfl1-1\testcodenameone\build.xml:155: Class not found: javac1.8
Total time: 3 seconds
You need Eclipse itself to run under JDK 1.7 (this needs to be configured via the Eclipse ini file). Also make sure JAVA_HOME points to JDK 1.7.
Related
I am attempting to build 'oboe' on a windows machine using cmake (version 3.25.0) and a visual studio generator. The end goal is to create a c++ audio library that uses oboe as the back end for android, but as a first step simply geting oboe to build is the plan.
I have managed to succesfully generate build and use a static library with a few simple test functions using the method described below, but I run into errors when attempting to build oboe.
I have also managed to get oboe to build by using the method described in the documentation and
doing add_subdirectory etc. in the CMakeLists file of android studio. However I am trying to generate/ build using cmake outside of android studio.
The oboe repo is found here: https://github.com/google/oboe
The toolchain file I am using is: 'android.toolchain.cmake' included in the NDK at the location: ndk version/build/cmake/android.toolchain.cmake
I use a batch script to automate generating/ building to several different android ABI's, inspired by a similar shell script included with the oboe repo 'build_all_android.sh'. The .bat script I made is shown below:
#echo OFF
set BUILD_DIR=build
set ANDROID_NDK=C:\Microsoft\AndroidNDK\android-ndk-r23c
set GENERATOR="Visual Studio 17 2022"
set CMAKE_GENERATOR=-G %GENERATOR%
set CMAKE_TOOLCHAIN_FILE=-DCMAKE_TOOLCHAIN_FILE=%ANDROID_NDK%\build\cmake\android.toolchain.cmake
set CMAKE_SYSTEM_NAME=-DCMAKE_SYSTEM_NAME=Android
set EXTRA_CMAKE_ARGS=-DBUILD_SHARED_LIBS=true -DANDROID_TOOLCHAIN=clang -DANDROID_STL=c++_static
CALL :build_android armeabi-v7a ARM 16
CALL :build_android arm64-v8a ARM64 21
CALL :build_android x86_64 x64 21
CALL :build_android x86 x86 16
EXIT /B %ERRORLEVEL%
:build_android
set ABI_VERSION=%~1
set GENERATOR_PLATFORM=%~2
set MINIMUM_API_LEVEL=%~3
set CMAKE_ANDROID_ARCH_ABI=-DANDROID_ABI=%ABI_VERSION%
set ABI_BUILD_DIR=%BUILD_DIR%\%ABI_VERSION%
set CMAKE_GENERATOR_PLATFORM=-A %GENERATOR_PLATFORM%
set CMAKE_BUILD_DIR=-B %ABI_BUILD_DIR%
set CMAKE_MIN_API=-DANDROID_PLATFORM=android-%MINIMUM_API_LEVEL%
set CMAKE_ARGS=%CMAKE_BUILD_DIR% %CMAKE_ANDROID_ARCH_ABI% %CMAKE_GENERATOR% %CMAKE_GENERATOR_PLATFORM% %CMAKE_SYSTEM_NAME% %CMAKE_TOOLCHAIN_FILE% %CMAKE_MIN_API%
echo building for android ABI: %ABI_VERSION%
echo cmake arguments = %CMAKE_ARGS%
echo:
cmake %CMAKE_ARGS% %EXTRA_CMAKE_ARGS%
echo:
cmake --build %ABI_BUILD_DIR% --target ALL_BUILD
echo:
echo:
EXIT /B 0
When I run this using the ANDROID_NDK variable (line 3) pointing to the root of the up to date ndk that comes with the visual studio 2022 android tools, I get an error:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Microsoft/AndroidNDK/android-ndk-r23c/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/Microsoft/AndroidNDK/android-ndk-r23c/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):
The C compiler
"C:/Microsoft/AndroidNDK/android-ndk-r23c/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/user/Documents/Code Projects/oboe/build/x86/CMakeFiles/CMakeScratch/TryCompile-pp2ibg
Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_c21fb.vcxproj /p:Configuration=Debug /p:Platform=x86 /p:VisualStudioVersion=17.0 /v:m && MSBuild version 17.4.1+9a89d02ff for .NET Framework
ANDROID_HOME=C:\\Microsoft\AndroidSDK\25
ANDROID_SDK_ROOT=C:\\Microsoft\AndroidSDK\25
ANT_HOME=
JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08
NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c
testCCompiler.c
In file included from <built-in>:349:
<command line>(1,9): warning : '__ANDROID_API__' macro redefined [-Wmacro-redefined] [C:\Users\user\Documents\Code Projects\oboe\build\x86\CMakeFiles\CMakeScratch\TryCompile-pp2ibg\cmTC_c21fb.vcxproj]
#define __ANDROID_API__ 1
^
<built-in>(342,9): note: previous definition is here
#define __ANDROID_API__ __ANDROID_MIN_SDK_VERSION__
^
1 warning generated.
ld: error: cannot open crtbegin_so.o: No such file or directory
ld: error: unable to find library -llog
ld: error: unable to find library -landroid
ld: error: cannot open crtend_so.o: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Application Type\Android\3.0\Android.Common.targets(125,5): error MSB6006: "clang.exe" exited with code 1. [C:\Users\user\Documents\Code Projects\oboe\build\x86\CMakeFiles\CMakeScratch\TryCompile-pp2ibg\cmTC_c21fb.vcxproj]
CMake will not be able to correctly generate this project.
and cmake fails to generate the project. I can actually get this to generate correctly, but only if I set the android NDK version within the cross-compilation options of visual studio to use the NDK bundled with my installation of Android studio, and also set the ANDROID_NDK variable of the batch script to point to the same root.
In this case, though cmake generates the project the build fails with a similar reason to the warning given above:
Building Custom Rule C:/Users/user/Documents/Code Projects/oboe/CMakeLists.txt
AAudioLoader.cpp
In file included from <built-in>:404:
<command line>(1,9): error : '__ANDROID_API__' macro redefined [-Werror,-Wmacro-redefined] [C:\Users\user\Documents\Co
de Projects\oboe\build\x86\oboe.vcxproj]
#define __ANDROID_API__ 16
^
<built-in>(394,9): note: previous definition is here
#define __ANDROID_API__ __ANDROID_MIN_SDK_VERSION__
^
1 error generated.
Thanks in advance for any help, it is much appreciated!
Your build fails because you instruct the compiler to view the warning '__ANDROID_API__' macro redefined as an error. And this warning seems to occur because Visual Studio still sets the macro __ANDROID_API__ instead of setting __ANDROID_MIN_SDK_VERSION__. I think that is a Visual Studio bug that was introduced when they started shipping the NDK 23 instead of 21.
EDIT:
This issue is being tracked here.
When I run the program, I get a gradle build error:
null value in entry:other File Outputs=null
When I click in see complete output in console on my gradle console I can see this:
Executing tasks: [:app:assembleDebug]
Configuration on demand is an incubating feature.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\Mindu Laptop\AppData\Local\Android\sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
I am not using NDK and in my local.properties i have
#This file is automatically generated by Android Studio.
#Do not modify this file -- YOUR CHANGES WILL BE ERASED!
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Apr 18 16:25:21 NPT 2017
sdk.dir=C\:\\Users\\Mindu Laptop\\AppData\\Local\\Android\\sdk
Things that i have tried:
Clean project/Rebuild Project
Invalidate caches and restart
Edited:Fixed,In my case it was due to white space in the location of the sdk
I'm trying to compile a new project on cmd using cocos2d-x v3.10, but the build is failing and I'm getting the following error:
The output as seen on cmd.
-pre-compile:
-compile:
[javac] Compiling 29 source files to D:\Varun\MyApp\MyApp\cocos2d\cocos\platform
\android\java\bin\classes
[javac] error: error reading D:\Varun\MyApp\MyApp\cocos2d\cocos\platform\android
\java\libs\._android-async-http-1.4.8.jar; error in opening zip file
[javac] warning: [options] source value 1.5 is obsolete and will be removed
in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed
in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use
-Xlint:-options.
[javac] 1 error
[javac] 3 warnings
BUILD FAILED
D:\adt-bundle-windows-x86_64-20140321\sdk\tools\ant\build.xml:601: The following
error occurred while executing this line:
D:\adt-bundle-windows-x86_64-20140321\sdk\tools\ant\build.xml:720: The following
error occurred while executing this line:
D:\adt-bundle-windows-x86_64-20140321\sdk\tools\ant\build.xml:734: Compile faile
d; see the compiler error output for details.
Total time: 2 seconds
Error running command, return code: 1.
I'm using the following:
JDK: 1.8.0_73
Android api: 19
NDK: r9
Ant: 1.9.6
Python: 2.7.11
I think ._android-async-http-1.4.8.jar is a hidden file or the file is corrupted.
For case one, just rename it to android-async-http-1.4.8.jar and refer it to again.
For case two, just download a new one.
I'm trying to compile the examples included in GStreamer. I'm following this tutorial
but I can't compile any of the included examples because ant debug give me this error:
-compile:
[javac] Compiling 4 source files to F:\Android\gstreamer\share\gst-sdk\tutorials\android-tutorial-1\bin\classes
[javac] F:\Android\gstreamer\share\gst-sdk\tutorials\android-tutorial-1\src\com\gst_sdk_tutorials\tutorial_1\Tutorial1.java:8: package com.gstreamer does not exist
[javac] import com.gstreamer.GStreamer;
[javac] ^
[javac] F:\Android\gstreamer\share\gst-sdk\tutorials\android-tutorial-1\src\com\gst_sdk_tutorials\tutorial_1\Tutorial1.java:20: cannot find symbol
[javac] symbol : variable GStreamer
[javac] location: class com.gst_sdk_tutorials.tutorial_1.Tutorial1
[javac] GStreamer.init(this);
[javac] ^
[javac] 2 errors
BUILD FAILED
F:\Android\android-sdk\tools\ant\build.xml:716: The following error occurred while executing this line:
F:\Android\android-sdk\tools\ant\build.xml:730: Compile failed; see the compiler error output for details.
Total time: 1 second
I have installed the latest version of android ndk and android sdk, I'm using API 19 and gstreamer 1.7.1 (gstreamer-1.0-android-arm-1.7.1.tar.bz2) downloaded from here; I'm using CygWin64 as required in the tutorial and ANT from Apache. I have also declared all the required local variables.
I can run the first command: android update project -p . -s --target 19
and also the second: ndk-build
If the compiling process is not possible with the command line, where can I get a working version of Eclipse with adt plugins?
I solved: since I'm using Gstreamer 1.7.1 the import line import com.gstreamer.GStreamer; must be changed into import org.freedesktop.gstreamer.GStreamer;.
When trying to instrument APK it shows Instrumenting APK unsuccessful. Error instrumenting APK. When the emulator was opened before instrumenting in console it showed "Could not initialize OpenglES emulation, using software renderer."
After instrumentation it showed error with message
This is message shown in console
System.getProperty("java.home") = C:\Program Files (x86)\Java\jdk1.7.0_51\jre
Instrumenting C:\Users\dinu\Desktop\EventManagement\CellStash.apk using C:\Users\dinu\AppData\Local\Temp\tools_AndroidInstrumentor1397189107139\tools\mtagent\monkeytalk-agent.jar
Unpacking tools into C:\Users\dinu\AppData\Local\Temp\tools_AndroidInstrumentor1397189107139\tools
Analyzing package Step 1 of 2
Unbundle started in C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1
Unbundle completed with exit code 0
Unbundle output:
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\dinu\apktool\framework\1.apk
I: Loaded.
I: Regular manifest package...
I: Decoding file-resources...
S: Could not decode file, replacing by FALSE value: drawable/popup.9.png
S: Could not decode file, replacing by FALSE value: drawable-mdpi/popup_bg.9.png
S: Could not decode file, replacing by FALSE value: drawable/action_item_selected.9.png
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...
Generated project directory: CellStash
AndroidTarget was no defined, obtaining last android target installed
androidTarget= android-19
Analyzing package Step 2 of 2
Dex started: C:\Users\dinu\Desktop\EventManagement\CellStash.apk
Dex completed with exit code 0
Dex output: dex2jar C:\Users\dinu\Desktop\EventManagement\CellStash.apk -> CellStash-dex2jar.jar
Updating package Step 1 of 2
android update project begins: [C:\Users\dinu\AppData\Local\Android\android-sdk\tools\android.bat, update, project, --target, android-19, --path, .]
android update project completed with exit code 0
android update project output:
'xcopy' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
Updated and renamed default.properties to project.properties
Updated local.properties
No project name specified, using Activity name 'MainActivity'.
If you wish to change it, edit the first line of build.xml.
Added file C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\build.xml
Added file C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\proguard-project.txt
Analyzing package Step 2 of 2
build of instrumented project begins...
Using android target= android-19
Building with command line: [C:\Users\dinu\AppData\Local\Temp\tools_AndroidInstrumentor1397189107139\tools\ant\bin\ant.bat, -DAPKJAR_DEX=C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\CellStash-dex2jar.jar, -DMTAGENT=C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\libs\monkeytalk-agent.jar, -DERROR_LEVEL=ignore, -DASPECTJ_HOME=C:\Users\dinu\AppData\Local\Temp\tools_AndroidInstrumentor1397189107139\tools\AspectJ, -DANDROID_HOME=C:\Users\dinu\AppData\Local\Android\android-sdk, -DPROJECT_NAME=CellStash, instrument_apk]
Build completed with exit code -1
Build output:
Buildfile: C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\build.xml
weave_aspects:
[move] Moving 1 file to C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\libs
-set-mode-check:
-set-debug-files:
-check-env:
[checkenv] Android SDK Tools Revision 22.6.2
[checkenv] Installed at C:\Users\dinu\AppData\Local\Android\android-sdk
-setup:
[echo] Project Name: CellStash
[gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 19.0.3
[echo] Resolving Build Target for CellStash...
[gettarget] Project Target: Android 4.4.2
[gettarget] API level: 19
[gettarget] WARNING: No minSdkVersion value set. Application will install on all Android versions.
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\bin
[mkdir] Created dir: C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\bin\res
[mkdir] Created dir: C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\bin\rsObj
[mkdir] Created dir: C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\bin\rsLibs
[mkdir] Created dir: C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\gen
[mkdir] Created dir: C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\bin\classes
[mkdir] Created dir: C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\bin\dexedLibs
[echo] ----------
[echo] Resolving Dependencies for CellStash...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'debug'...
[subant] No sub-builds to iterate on
-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] Generating resource IDs...
[aapt] C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\res\values\drawables.xml:3: error: Resource entry action_item_selected is already defined.
[aapt] res\drawable\action_item_selected.9.png:0: Originally defined here.
[aapt] C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\res\values\drawables.xml:4: error: Resource entry popup is already defined.
[aapt] res\drawable\popup.9.png:0: Originally defined here.
[aapt] C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\res\values-mdpi\drawables.xml:3: error: Resource entry popup_bg is already defined.
[aapt] res\drawable-mdpi\popup_bg.9.png:0: Originally defined here.
BUILD FAILED
C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\build_master.xml:653: The following error occurred while executing this line:
C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\build_master.xml:698: null returned: 1
Total time: 8 seconds
: ERROR: Process exited with an error: 1 (Exit value: 1)
instrumented APK file was not created at: C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\bin\CellStash-debug.apk
Error instrumenting apk 'C:\Users\dinu\Desktop\EventManagement\CellStash.apk': instrumented APK file was not created at: C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\bin\CellStash-debug.apk
com.gorillalogic.monkeytalk.instrumentor.android.AndroidInstrumentor$InstrumentationException: instrumented APK file was not created at: C:\Users\dinu\AppData\Local\Temp\tmp_AndroidInstrumentor1397189107138_1\CellStash\bin\CellStash-debug.apk
at com.gorillalogic.monkeytalk.instrumentor.android.AndroidInstrumentor.copyInstrumentedApk(AndroidInstrumentor.java:235)
at com.gorillalogic.monkeytalk.instrumentor.android.AndroidInstrumentor.beginInstrumentation(AndroidInstrumentor.java:199)
at com.gorillalogic.monkeytalk.instrumentor.android.AndroidInstrumentor.instrumentApk(AndroidInstrumentor.java:130)
at com.gorillalogic.monkeytalk.ide.instrumentor.InstrumentApkAction$InstrumentApkJob.run(InstrumentApkAction.java:137)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Hello it seems you are not the only one with this problem, it's related with Android's pkg-tool and how it's using a decode function (that double checks for the png raw data)
On cloud monkey's forum you will see these two threads:
Error instrumenting apk
Instrumentation failed
I went into android-apktool's forum and basically found this
Project Member #1 connor.tumbleson
This would be a feature prevention against bad PNG's. This isn't a bug.
Status: Invalid
So basically it seems you have invalid 9-Path images could you please try using other 9-Patch image instead (just for testing purposes) and corroborate this?