When signing and building my application for release through ant in eclipse I am getting an error.
I am using the ant task that comes with the android sdk.
Keystore file, alias, pass are defined in ant.properties.
BUILD FAILED
C:\Program Files
(x86)\Android\android-sdk-windows\tools\ant\build.xml:981: The
following error occurred while executing this line:
C:\Program Files
(x86)\Android\android-sdk-windows\tools\ant\build.xml:995: Execute
failed: java.io.IOException: Cannot run program "jarsigner.exe" (in
directory "C:\dev\projects\sample1"): CreateProcess error=2, The
system cannot find the file specified
Followed instructions here: http://developer.android.com/guide/developing/building/building-cmdline.html
You need to have the folder YOUR_JDK\bin in your path
(YOUR_JDK being the folder where you have installed the Java JDK)
It's looking for the Jar signer in the wrong location.
Might be worth checking your path environment variable is set up correctly (so that it can find jarsigner.exe)
Related
How can I build an APK file from the command line? I've tried
MSBuild myProject.dproj /p:Config=Release /p:Platform=Android
but no APK file is produced, only the .so file.
Some experimentation shows that the following aspects of the various proposed courses of action come into play for a more complete picture.
When you create a new Delphi multi-target project (let's call it Foo) you have one MSBuild-compatible file created: the Foo.dproj Delphi project file. In the case of Android (the platform in this question) this is enough to build the target libFoo.so library file that would eventually become part of a deployed .apk file, but is not enough to make the .apk file just yet.
You can build your .so file, which contains the ARM machine code, using a command line like this:
msbuild Foo.dproj /property:Config=Debug /property:Platform=Android /target:Build
or this more concise version:
msbuild Foo.dproj /p:Config=Debug /p:Platform=Android /t:Build
As per the documentation you can use the Deployment Manager's Deploy button to create an additional MSBuild file, or indeed just choose the Project, Deploy libFoo.so menu item. The initial step of this deployment is to create a Foo.deployproj file, which is another MSBuild-compatible file.
With Foo.deployproj file present this following line will take the libFoo.so file and anything else required for deployment and use these to build up the .apk Android application package file:
msbuild Foo.dproj /p:Config=Debug /p:Platform=Android /t:Deploy
The Deploy target will fail if the required files such as libFoo.so are not present, say by previously running MSBuild using the Build or Make MSBuild targets: s(431,5): error : Required local file "Android\Debug\libFoo.so" not found. Deployment failed.
Additionally the Deploy target fails if you have not got a Foo.deployproj file generated for your project: error MSB4057: The target "Deploy" does not exist in the project.
That said, if you have the Foo.deployproj present you can build and deploy in one fell swoop with something like:
msbuild Foo.dproj /p:Config=Debug /p:Platform=Android /t:Build;Deploy
Of course to avoid compiling files that have not changed this is perhaps better:
msbuild Foo.dproj /p:Config=Debug /p:Platform=Android /t:Make;Deploy
The fact that the documentation doesn't mention anything about the Deploy target is a little confusing. There is potential to think that it implies you run MSBuild against Foo.deployproj file, but that yields no joy whatsoever. It seems the documentation is out of date or plain wrong.
I found:
MSBuild Project1.dproj /p:Config=Debug /p:Platform=Android /t:Deploy
When trying to reference a .AAR java library binding we received the following error:
Unexpected error - Please file a bug report at http://bugzilla.xamarin.com. Reason: System.IO.DirectoryNotFoundException: Could not find a part of the path "\\####\####\Developer\Mobile Apps\Android\####.Android\Project Files\####.Xamarin.Android\obj\Release\__library_projects__\IntercomForXamarinAndroidBase\library_project_imports\res\drawable-xxhdpi\intercomsdk_chat_bubble_right_aligned_notail.9.png" (XA0000) (####.Xamarin.Android) monodroid
Turns out it was because the file path was too long.
Installed windows hotfix:
A file copy operation fails when files or folders have long paths in Windows Explorer
I know that .apk files are zip files and when we extract them can parse manifest file inorder to finding some information about the app. It is very useful for someone like me that is going to create an app-store. Actually at least I can find the version name and version code of the app.
But in the android-studio when we build a signed apk the version name and version code is not defining in the manifest file. We should define them in the build.gradle file. So now in my app-store when users upload the files how can I find the version code and version name and detect that is not same with old versions?
Just use AAPT from your path/to/your/android-sdk/build-tools/your-api-version-available/...
An example of the command execution:
aapt dump badging theuserapp.apk
And it will respond with something like:
package: name='com.blabla.theuserapp' versionCode='2000' versionName='2.0.0'
Of course, as the tool is an executable which produces a raw text output you can easily script it and parse from your favorite scripting languaje.
On GNU/Linux environment you can make a bash search.
with these steps:
-> on Studio choose terminal tab;
-> change directory to root directory of your project.
-> run this command $ find pwd -name *.apk
-> yours apk files will be listed on the screen, then you can see the directory where they are hosted
I am getting error while trying to build android ndk project:
error: jni.h: No such file or directory
But: locate jni.h command show me:
locate jni.h
/usr/lib/jvm/java-6-openjdk-i386/include/jni.h
What is wrong in my actions?
EDIT:
If I hardcode it in the source code it work but I have a lot of files that are using this header. What I need to do that all my files can see /usr/lib/jvm/java-6-openjdk-i386/include/jni.h
?
Try setting the installation location of your NDK in PATH in your rc file, let's say ~/.bashrc:
NDK=/path/to/your/ndk/location
export PATH=$PATH:$NDK
Source the rc file by running source ~/.bashrc.
Now when you run ndk-build, it will setup the whole build environment for you by running make command against a bunch of make files under $NDK/build/core, it will setup correct header file search path for your project depending on the android:targetSdkVersion setting in AndroidManifest.xml.
The jni.h needed by your NDK project is located under $NDK/platforms/android-14/arch-arm/usr/include.
Android NDK projects will not use any JNI header files under your JDK installation, files under /usr/lib/jvm/.... will never be touched.
when i am trying to run a simple android application in netbeans 6.9.1 i am getting the below error:
**Creating output directories if needed...
Generating R.java / Manifest.java from the resources...
Compiling aidl files into Java classes...
compile:
C:\Program Files\Android\android-sdk-windows\tools\ant\main_rules.xml:361: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
Compiling 1 source file to C:\Documents and Settings\JiggleVostro1310\My Documents\NetBeansProjects\FTPClient\bin\classes
Converting compiled files and external libraries into C:\Documents and Settings\JiggleVostro1310\My Documents\NetBeansProjects\FTPClient\bin\classes.dex...
=C:\Documents was unexpected at this time.
C:\Program Files\Android\android-sdk-windows\tools\ant\main_rules.xml:449: The following error occurred while executing this line:
C:\Program Files\Android\android-sdk-windows\tools\ant\main_rules.xml:199: apply returned: 255
BUILD FAILED (total time: 1 second)**
Can anyone explain me what this means and how to resolve this. I am new to android applications
I suspect that there's a bug in the Ant scripts somewhere and something isn't properly handling path names that contain spaces. Try moving your project to a directory outside My Documents, to somewhere like C:\AndroidProjects\FTPClient.
=C:\Documents makes me think you have a bad setting somewhere. One of two things is likely happening:
That equals sign before the path is causing the failure.
A path is specified somewhere which requires being wrapped in quotes but isn't, because of the space in the path (ex: should be "C:\Documents And Settings...")
I would check your build properties and paths, as well as any included JAR files or Library projects for a small typo.