I have this in my Main.axml;
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
>
<Button
android:id="#+id/MyButton"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="#string/Hello"/>
<ImageView
android:src="#drawable/samplebackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/MyButton"/>
</RelativeLayout>
It builds fine and sampleBackground is a jpg that has been included in my project.
However when I try to deploy I get an error;
Object reference not set to an instance of an object
And there are a bunch of lines stating <filename unknown>
If I remove the ImageView from the markup the application deploys fine.
Any thoughts?
full stack
------ Build started: Project: MonoAndroidApplication1, Configuration: Debug Any CPU ------
MonoAndroidApplication1 -> C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\bin\Debug\MonoAndroidApplication1.dll
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.225]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 8/06/2011 8:37:40 AM.
Project "C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\MonoAndroidApplication1.csproj" on node 1 (SignAndroidPackage target(s)).
_GenerateAndroidAssetsDir:
Skipping target "_GenerateAndroidAssetsDir" because it has no outputs.
_ResolveMonoAndroidSdks:
Looking for Android SDK..
Key HKCU\SOFTWARE\Android SDK Tools\Path not found.
Key HKLM\SOFTWARE\Android SDK Tools\Path found:
Path contains adb.exe in \platform-tools (C:\Program Files\Android\android-sdk).
Looking for Java SDK..
Key HKLM\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion found: 1.6.
Key HKLM\SOFTWARE\JavaSoft\Java Development Kit\1.6\JavaHome found:
Path contains jarsigner.exe in \bin (C:\Program Files\Java\jdk1.6.0_25).
MonoAndroid Tools: C:\Program Files\MSBuild\Novell\
MonoAndroid Framework: C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\;C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\
Android SDK: C:\Program Files\Android\android-sdk\
Java SDK: C:\Program Files\Java\jdk1.6.0_25\
_ValidateAndroidPackageProperties:
GetAndroidPackageName Task
ManifestFile:
AssemblyName: MonoAndroidApplication1
PackageName: MonoAndroidApplication1.MonoAndroidApplication1
_UpdateAndroidResgen:
Skipping target "_UpdateAndroidResgen" because all output files are up-to-date with respect to the input files.
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
_CopyOutOfDateSourceItemsToOutputDirectoryAlways:
Copying file from "C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\Resources\Drawable-land\Icon.png" to "bin\Debug\Resources\Drawable-land\Icon.png".
CopyFilesToOutputDirectory:
MonoAndroidApplication1 -> C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\bin\Debug\MonoAndroidApplication1.dll
ContractDeclarativeAssemblyCS:
Skipping target "ContractDeclarativeAssemblyCS" because all output files are up-to-date with respect to the input files.
_ConvertDebuggingFiles:
Skipping target "_ConvertDebuggingFiles" because all output files are up-to-date with respect to the input files.
_CompileAndroidPackage:
Mandroid Task
Assemblies: C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\bin\Debug\MonoAndroidApplication1.dll; C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll; C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll; C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll; C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll; C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll; C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.Linq.dll
I18nAssemblies:
BuildDirectory: C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\obj\Debug\
ReferenceAssembliesDirectory: C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\;C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\;;
AndroidSdkDirectory: C:\Program Files\Android\android-sdk\
JavaSdkDirectory: C:\Program Files\Java\jdk1.6.0_25\
AssetDirectory: C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\obj\Debug\assets\
AndroidSdkPlatform: 8
MonoAndroidToolsDirectory: C:\Program Files\MSBuild\Novell\
ResourceDirectory: C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\obj\Debug\res\
ManifestTemplate:
Package: MonoAndroidApplication1.MonoAndroidApplication1
NativeLibrary:
JavaSource:
Debug: True
UseSharedRuntime: True
SupportedAbis: armeabi
LinkMode: None
ExtraArgs:
C:\Program Files\MSBuild\Novell\mandroid.exe -v --nosign --sdk-dir="C:\Program Files\Android\android-sdk" --builddir="C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\obj\Debug\android" --framework-dir="C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2" --framework-dir="C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0" -S="C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\obj\Debug\res" --package="MonoAndroidApplication1.MonoAndroidApplication1" --nolink --abi="armeabi" --java-sdk-dir="C:\Program Files\Java\jdk1.6.0_25" --debug --sdk-platform="8" -A="C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\obj\Debug\assets" "C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\bin\Debug\MonoAndroidApplication1.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.Linq.dll"
monodroid : error 1: System.NullReferenceException: Object reference not set to an instance of an object [C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\MonoAndroidApplication1.csproj]
at MonoDroid.Utils.ProcessRocks+c__Iterator5.MoveNext () [0x00000] in :0
at Monodroid.Toolbox.InvokeCommand (IEnumerable1 commandLine) [0x00000] in <filename unknown>:0
at Monodroid.Toolbox.InvokeAapt (System.String packageName) [0x00000] in <filename unknown>:0
at Monodroid.Droidinator.CreatePackagedResources (System.Collections.Generic.List1 javaTypes) [0x00000] in :0
at Monodroid.Droidinator.CreateApk () [0x00000] in :0
at Monodroid.MainClass.Main (System.String[] argv) [0x00000] in :0
Done Building Project "C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\MonoAndroidApplication1.csproj" (SignAndroidPackage target(s)) -- FAILED.
Build FAILED.
"C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\MonoAndroidApplication1.csproj" (SignAndroidPackage target) (1) ->
(_CompileAndroidPackage target) ->
monodroid : error 1: System.NullReferenceException: Object reference not set to an instance of an object [C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\MonoAndroidApplication1.csproj]
EDIT:
I found the solution; just make sure the image filename is in lowercase.
My image was named Image.png by renaming it to image.png it worked.
It's easy enough to reproduce - just create a new solution with a layout with a ImageView. Set the android:src="#drawable/Image".
If I type the Image with lowercase, image, it gives a compiler error, but when i correct it to Image no compile time errors, but the packaging fails...
The Image is in the correct folder and set to AnddroidResource.
So I would indeed like some help on this one too.
Thanks, Nicklas
Make sure that the Build Action for that image file is set to AndroidResource. You can set the Build Action by right clicking on the file in Visual Studio and selecting Properties.
Related
I have tried to assemble my project as a release. But it always failed. Below are some of the script that I use to build my apk as release:-
BUILD SUCCESSFUL
.\gradlew assembleDebug --no-daemon
.\gradlew app:assembleDebug
BUILD FAILED
.\gradlew app:assembleRelease
.\gradlew assembleRelease -x bundleReleaseJsAndAssets
The result of the failed mention on every failed build:-
> Execution failed for task ':app:mergeReleaseResources'
> Task :app:mergeReleaseResources
> FAILED cvc-type.3.1.3: The value '' of element 'id' is not valid.
I also have try to create keystore using keytool and apply it to the signingConfigs in
./android/app/build.gradle
but no success on release. So, I'm reverting and use default debug.keystore value
Referring various answer from forum, SO question, tutorial I have try to apply. I'm totally stuck.
Does anyone face this issue and able to overcome the obstacles?
Edited: Error log when build
Using .\gradlew assembleRelease
D:\Project\Clients\android>.\gradlew assembleRelease
> Configure project :react-native-activity-result
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.4.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
> Task :react-native-activity-result:verifyReleaseResources FAILED
> Task :app:bundleReleaseJsAndAssets
Loading dependency graph, done.
info Writing bundle output to:, D:\Project\Clients\android\app\build\generated\assets\react\release\index.android.bundle
info Writing sourcemap output to:, D:\Project\Clients\android\app\build\intermediates\sourcemaps\release\index.android.bundle.packager.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 47 asset files
info Done copying assets
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-activity-result:verifyReleaseResources'.
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:7: error: resource android:attr/colorError not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:11: error: resource android:attr/colorError not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values\values.xml:2734: error: resource android:attr/fontStyle not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values\values.xml:2735: error: resource android:attr/font not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values\values.xml:2736: error: resource android:attr/fontWeight not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values\values.xml:2737: error: resource android:attr/fontVariationSettings not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values\values.xml:2738: error: resource android:attr/ttcIndex not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values\values.xml:2902: error: resource android:attr/startX not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values\values.xml:2905: error: resource android:attr/startY not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values\values.xml:2908: error: resource android:attr/endX not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values\values.xml:2911: error: resource android:attr/endY not found.
D:\Project\Clients\node_modules\react-native-activity-result\android\build\intermediates\res\merged\release\values\values.xml:2919: error: resource android:attr/offset not found.
error: failed linking references.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
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.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2m 54s
210 actionable tasks: 22 executed, 188 up-to-date
D:\Project\Clients\android>
Used to face this, it was an APPT2 issue (at least in my case). From the screenshot shared, it tells you Duplicate resources. This may happen after you performed a js bundling, and few folders with resources were created.
Below's how I take care APPT2 issue:
Try navigating to (android/app/build/intermediates/res/merged/release/
See if there's any drawable-* folder
Perform rm -rf android/app/build/intermediates/res/merged/release/drawable-*)
Try again ./gradlew assembleRelease (you probably still fail to build here)
Back to the same folder, remove .DS_Store
Build again
Hopefully succeed
In some react native version it is a bug. you can do the following:
in the node_modules/react-native folder, find the react.gradle file,
then after the doFirst add the following code:
doLast {
def moveFunc = { resSuffix ->
File originalDir =
file("$buildDir/generated/res/react/release/drawable-${resSuffix}");
if (originalDir.exists()) {
File destDir =
file("$buildDir/../src/main/res/drawable-${resSuffix}");
ant.move(file: originalDir, tofile: destDir);
}
}
moveFunc.curry("ldpi").call()
moveFunc.curry("mdpi").call()
moveFunc.curry("hdpi").call()
moveFunc.curry("xhdpi").call()
moveFunc.curry("xxhdpi").call()
moveFunc.curry("xxxhdpi").call()
}
then you can use the ./gradlew assembleRelease generate the apk.
At the same time, when you want to know what the errr is during the build process, you can use ./gradlew assembleRelease --info commod
I FINALLY CAN CREATE RELEASE APK
Create a keystore by running command keytool -genkey -v -keystore myappkeystore.keystore -alias myappalias-keyalg RSA -keysize 2048 -validity 10000 and place it on .\android\app. Details instruction can be follow from here
Open file named build.gradle and look for section name signingConfigs
Insert below script after debug keyname and replace with what key that you register:-
release {
storeFile file('mycreatedkeystore.keystore')
storePassword 'mypassword'
keyAlias 'mykeyalias'
keyPassword 'mypassword'
}
Open blank notepad and paste below script:-
#echo off
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------
if not defined in_subprocess (cmd /k set in_subprocess=y ^& %0 %*) & exit )
set driveName="%CD:~0,2%"
set currentFolder="%~dp0"
setlocal enableextensions enabledelayedexpansion
set /A count=1
set list=
CD %driveName%
echo ===========================================
for /d %%D in (*) do (
set "listName=%%~f"
set list=%listName%%1
rem echo !listName! !
echo !count!^. %%~D
set /a count+=1
)
echo ===========================================
:startAgain
set choice=
set /p choice=Type in target folder from listing to build release APK (e.g. targetfolder):
if not '%choice%'=='' (
if exist %choice% (
set choice=%choice%
CD %choice%
goto performbuild
)
)
echo Invalid directory name!
goto startAgain
:performbuild
echo Script will start build target APK to release on %choice%...
timeout /t 2 /nobreak>nul
call react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
rem start "" %currentFolder%%choice%^\android\app\src\main\res
timeout /t 2 /nobreak>nul
cd %currentFolder%%choice%^\android\app\src\main\res
echo Validating duplicating resources
if exist "drawable-hdpi" rmdir "drawable-hdpi" /q /s
if exist "drawable-mdpi" rmdir "drawable-mdpi" /q /s
if exist "drawable-xhdpi" rmdir "drawable-xhdpi" /q /s
if exist "drawable-xxhdpi" rmdir "drawable-xxhdpi" /q /s
if exist "drawable-xxxhdpi" rmdir "drawable-xxxhdpi" /q /s
if exist "raw" rmdir "raw" /q /s
cd %currentFolder%%choice%^\android
call gradlew assembleRelease -x bundleReleaseJsAndAssets
start "" %currentFolder%%choice%^\android\app\build\outputs\apk\release"
cd %currentFolder%%choice%
:choiceOpt
set /P answ=Build complete. Do you want to rebuild again[Y/N]?
if /I "%answ%" EQU "Y" goto :performbuild
if /I "%answ%" EQU "N" goto :justexit
goto :choiceOpt
:justexit
echo Exiting
timeout /t 2 /nobreak>nul
exit
Save the file with any name and set the extension to .BAT
Place the BAT file on one folder up of your root project e.g.
Your project folder:- C:\Project\Mobile\MyCurrentProject
Your batch file folder:- C:\Project\Mobile\releaseTool.bat
Run the releaseTool.bat and the batch file with build the release version
I search and found several script to accomplish certain oart and combine it to make this batch script for RELEASE APK version
Disclaimer: I'm not an expert to elaborate the process or argue regarding the way I'm doing it (if it is not practical) because I have failed to build what I wanted and pieces-by-pieces solution is combined and become what I provided.
After upgrading Delphi from v10.2.2 to v10.2.3, the TBannerAd banner raised exception when trying to call the LoadAd method.
After understanding that "Tokyo 10.2.3 has updated Google Play Services and its libraries." (Google AdMob TBannerAd LoadAd exception after upgrading to Delphi v10.2.3), I tried the suggested fix of "Reverting System Files to Default" by right-clicking the Android Libraries node in the Project manager.
However, doing so broke compilation, returning this error:
[Exec Error] The command "PATH {my entire path} & "C:\Users\MyUser\Documents\Embarcadero\Studio\19.0\PlatformSDKs\android-sdk-windows\build-tools\27.0.2\dx.bat" --dex --output="Z:\Tic\Android\Debug\classes.dex" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\android-support-v4.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\cloud-messaging.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\fmx.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-analytics-v2.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-billing.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-licensing.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-ads-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-analytics-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-base-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-identity-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-maps-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-panorama-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-plus-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-wallet-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services.dex.jar" " exited with code 2.
I manually entered the command and this is the full error message:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:506)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:336)
at com.android.dx.command.dexer.Main.runDx(Main.java:291)
at com.android.dx.command.dexer.Main.main(Main.java:247)
at com.android.dx.command.Main.main(Main.java:94)
The Android SDK listed under the project manager is v24.3.3 32bit.
Did I miss updating something on the Android side?
I got an answer on the original thread that resolves this, it seems that using the "Reverting System Files to Default" option still left the old "google-play-services.dex.jar" service.
To fix the issue, I right-clicked the entry and selected "Disable", closed Delphi, opened my project's ".dproj" file in a text editor, searched for "DisabledSysJars" and removed the problematic entry.
I am trying to create my first android project using cordova on my Windows 7 machine. I have installed latest Android SDK (API-19 installed) and cordova. I have set path for ANDROID_PATH, ANDROID_PLATFORM_TOOLS, ANDROID_TOOLS and ANT_HOME.
Using directions from http://cordova.apache.org/docs/en/3.6.0//guide_cli_index.md.html#The%20Command-Line%20Interface I have created the "hello" project but as I try to add android platform using:
cordova platform add android
from my command prompt android emulator opens up showing android home screen, so I can navigate through the OS but soon as close it I get the output:
C:\devCenter\private\hello>cordova platform add android
Creating android project...
C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:126
throw e;
^
Error: Please install Android target "android-19".
Hint: Run "android" from your command-line to open the SDK manager.
at C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\lib\check_reqs.js:173:19
at _fulfilled (C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:798:54)
at self.promiseDispatch.done (C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:827:30)
at Promise.promise.promiseDispatch (C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:7
at C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:574:44
at flush (C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:419:13)
Error: cmd: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\think ahead\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
C:\devCenter\private\hello>
There is no android directory created inside platforms in "hello" project. Can someone please help me in pointing what I am missing/doing wrong.
Sceenshot of SDK
Window launched on "cordova platform add android"
EDIT:
Adding environment values:
C:\devCenter\private\hello>set
ALLUSERSPROFILE=C:\ProgramData
ANDROID_HOME=C:\devCenter\sdk
ANDROID_PLATFORM_TOOLS=C:\devCenter\sdk\platform-tools
ANDROID_TOOLS=C:\devCenter\sdk\tools
APPDATA=C:\Users\think ahead\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMMPath=C:\Program Files\Lenovo\Communications Utility
COMPUTERNAME=THINKAHEAD
ComSpec=C:\Windows\system32\cmd.exe
configsetroot=C:\Windows\ConfigSetRoot
FP_NO_HOST_CHECK=NO
HerokuPath=C:\Program Files (x86)\Heroku
HOMEDRIVE=C:
HOMEPATH=\Users\think ahead
LOCALAPPDATA=C:\Users\think ahead\AppData\Local
LOGONSERVER=\\THINKAHEAD
NODE_PATH=;%NODE_PATH%;C:\Users\think ahead\AppData\Roaming\npm\node_modules;C:\Dev\Opa\lib\opa\stdlib;C:\Dev\Opa\lib\opa\stdlib\stdlib.qmljs;C:\Dev\Opa\lib\opa\static;C:\Users\think ahead\AppData\Roaming\npm\node_modules;C:\Dev\Opa\lib\opa\stdlib;C:\Dev\Opa\lib\opa\stdlib\stdlib.qmljs;C:\Dev\Opa\lib\opa\static;%APPDATA%\npm\node_modules
NUMBER_OF_PROCESSORS=8
OPABASEDIR=C:\Dev\Opa
OS=Windows_NT
Path=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Dev\Opa\bin;C:\mongodb\bin;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Common Files\Lenovo;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\git\cmd;C:\Program Files\TortoiseSVN\bin;C:\Program Files\MIT\Kerberos\bin;C:\Program Files\Lenovo\Bluetooth Software\;C:\Program Files\Lenovo\Bluetooth Software\syswow64;C:\Program Files\TortoiseGit\bin;C:\Program Files\nodejs\;C:\Ruby193\bin;C:\Windows\System32;C:\SocketeQ\windowsandroid_root\system\bin;C:\SocketeQ\windowsandroid_root\system\lib;C:\Program Files\MIT\Kerberos\bin;C:\Program Files (x86)\HMA! Pro VPN\bin;C:\Users\think ahead\AppDa
ta\Roaming\npm
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.JS;.JS;.RB;.RBW
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=3a09
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
READYAPPS=C:\SWTOOLS\ReadyApps
SESSIONNAME=Console
SSH_AGENT_PID=371780
SSH_AUTH_SOCK=/tmp/ssh-vlsE376812/agent.376812
SWSHARE=C:\SWSHARE
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\THINKA~1\AppData\Local\Temp
TMP=C:\Users\THINKA~1\AppData\Local\Temp
TVT=C:\Program Files (x86)\Lenovo
TVTCOMMON=C:\Program Files (x86)\Common Files\Lenovo
USERDOMAIN=thinkahead
USERNAME=think ahead
USERPROFILE=C:\Users\think ahead
VBOX_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\
VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\
windir=C:\Windows
WINDOWSANDROID_ROOT=C:\SocketeQ\windowsandroid_root
windows_tracing_flags=3
windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log
I am new to ant and Android uiautomator. When using ant to build my testing program I get:
-dex:
[dex] input: c:\Eclipse\workspace\Android\bin\classes
[dex] Converting compiled files and external libraries into c:\Eclipse\wor
kspace\Android\bin\classes.dex...
[dx] no classfiles specified
BUILD FAILED
C:\Android\sdk\tools\ant\uibuild.xml:198: null returned: 1
This is on the sample test code at: http://developer.android.com/tools/testing/testing_ui.html#sample
The full output from running the 'android create uitest...' and 'ant build' commands follows:
c:\Eclipse\workspace\Android>android create uitest-project -n AllAppsTest -t 7 -
p C:\Eclipse\workspace\Android\
Updated file C:\Eclipse\workspace\Android\build.xml
c:\Eclipse\workspace\Android>ant build
Buildfile: c:\Eclipse\workspace\Android\build.xml
-check-env:
[checkenv] Android SDK Tools Revision 23.0.2
[checkenv] Installed at C:\Android\sdk
-build-setup:
[getbuildtools] Using latest Build Tools: 19.1.0
[echo] Resolving Build Target for AllAppsTest...
[getuitarget] Project Target: Android 4.2.2
[getuitarget] API level: 17
[echo] ----------
[echo] Creating output directories if needed...
-pre-compile:
compile:
-post-compile:
-dex:
[dex] input: c:\Eclipse\workspace\Android\bin\classes
[dex] Converting compiled files and external libraries into c:\Eclipse\wor
kspace\Android\bin\classes.dex...
[dx] no classfiles specified
BUILD FAILED
C:\Android\sdk\tools\ant\uibuild.xml:198: null returned: 1
Total time: 0 seconds
My problem is similar to Android ant build project failure which didn't seem to have an answer (or at least one that I could descern from the responses.
I can't post an image (not enough mojo yet) but my test project is set up as:
AllAppsTest
src
com.uia.example.my
LaunchSettings.java
JRE System Library[JavaSE-1.6] (there are number of jar files here but I am not
listing them here)
Referenced Libraries
android.jar
uiautomator.jar
JUnit 4
I executed the following:
c:\Eclipse\workspace\Android>android create uitest-project -n AllAppsTest -t 7 -
p C:\Eclipse\workspace\Android\
Updated file C:\Eclipse\workspace\Android\build.xml
c:\Eclipse\workspace\Android>ant build
Buildfile: c:\Eclipse\workspace\Android\build.xml
Which resulted in the 'ant build' error output at the top of this post.
Any ideas?
Thanks
Eric
Not sure this is kosher answering my own question but...
I believe there is an error in the documentation (or the create step) for executing the build.xml file. The build.xml must be copied to the project directory, in my case AllAppsTest, and the 'ant build' command executed from there.
So the sequence of events to get this to work (in Windows command window):
Run the 'android create' command
c:\Eclipse\workspace\Android>android create uitest-project -n AllAppsTest -t 7 -
p C:\Eclipse\workspace\Android\
Switch to the AllAppsTest directory
cd AllAppsTest
Copy the build.xml file from the parent directory
copy ../build.xml
(which for some reason copies local.properties and project.properties also)
Run the 'ant build' command
When I first tried this the build failed as it didn't like the single and double quotes I had that were on comment lines. Not sure why that was but I removed them and the ant build worked OK.
I have a mono android project. I can use monodevelop to build the apk of my project. But I want to write a build file (like we do using ANT) with targets that can generate the .apk file.
Please point me to the right direction.
I have figured out the we need to use mandroid.exe to generate .apk from the .dll.
the log shows that there is a target called _Manddroid that monodevelop's build tool runs. This target in turn runs following command
C:\Program Files\MSBuild\Novell\mandroid.exe -v --nosign --sdk-dir="C:\Android\android-sdk" --builddir="C:\Users\Sikha\Documents\Projects\helloShikha\helloShikha\obj\Debug\android" --framework-dir="C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2" --framework-dir="C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0" -S="C:\Users\Sikha\Documents\Projects\helloShikha\helloShikha\obj\Debug\res" --package="helloShikha.helloShikha" --nolink --abi="armeabi" --java-sdk-dir="C:\Program Files\Java\jdk1.6.0_30" --debug --sdk-platform="8" "C:\Users\Sikha\Documents\Projects\helloShikha\helloShikha\bin\Debug\helloShikha.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll"
When I try to copy paste the above command on cmd nothing happens. Any Idea what I am missing here?
I used following command and it generated the .apk file for me.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe myproject.csproj /t:Package
I tried using .sln file but was receiving an error : target Package does not exist in the project.
I opened the myproject.csproj file and figured out that this file imports Novell.MomoDroid.CSharp.Targets which in turn imports the Novell.MonoDroid.Common.Targets
The target "Package" is present in the file Novell.MonoDroid.Common.Targets.
Why do you want to write alternative targets? The Mono for Android project files are MSBuild-based, and MSBuild is Microsoft's equivalent of ant. This means the csproj files are already fully extensible and customizable, and can be built using the commandline MSBuild tool:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe YourSolution.sln