How do I update an Android project from a Jenkins job? - android

I am setting up Jenkins to clone my git project, update the project, then build using ant. If I perform an ls in the job after cloning the repo, I see my project.properties file present (containing target).
To update the project (and therefore generate the build.xml file) I issue the following command:
android update project -p ./
However, I get the following console output:
Error: The project either has no target set or the target is invalid.
Does anyone know how to update an android project from Jenkins and avoid this problem?

So you've eliminated the first part of the error (i.e. the project does have a target set), but not the second part.
The message "target is invalid" means that you don't have the target platform installed in the Android SDK that Jenkins is using.
e.g. if your target is android-17, then you need to install the Android 4.2 platform (for example via the command android update sdk -u -t android-17).
As an aside, you can automate both the relevant calls to android update -p and the installation of required target platforms using the Android Emulator Plugin for Jenkins.

Related

There are not available platforms

Im using cocos2d-x version 12 and NDKrc12 and I have all the paths in my
.bash_profile set. But when I build for android and type:
cocos compile -p android
It displays a message "There are not available platforms" which can't be because I have the android SDK installed in the correct path what is wrong?
On the latest version of cocos2d-x for some odd reason you need to use the '-s' option like this:
cocos run -s /Users/me/myprojects/mygame -p android
Otherwise without '-s' it displays "there are not available platforms"
seems unnecessary when your in your project folder but I guess it is!
Run android on the command line, this will open the Android SDK manager. From here make sure that you have installed the appropriate SDK for your device.
cd your project root, then open .cocos_project.json, find "android_cfg" arg, if you have the folder. if you don't find, then create a new cocos project, cocos compile, then judge which platform can run, in new project folder open .cocos_project.json. You can look for diffences between them.

ERROR: dump failed because no AndroidManifest.xml found

When I try to upload an application to Android Play store I get the following error:
ERROR: dump failed because no AndroidManifest.xml found
Steps that I took:
new HDD, install clean jre, jdk
download Android eclipse bundle - latest version today
make a new project, sample. simple hello world
sign it with the wizard, create a certificate etc.
try to upload it on the market...=ERROR!
I tried many combinations, different eclipse versions. Even to sign it manually. It doesn't work.
If I try to run aapt dump badging I get the same error.
Just write in the terminal
flutter clean
Just delete app.apk file from: /build/app/outputs/apk/app.apk.
Visual Studio will create a new correct app.apk file.
I dont know o 'why' of this.
I faced this problem using Visual Studio Code in a Flutter project and Im posting my solution because it can help others.
I just run 'Flutter Clean Project' and then I run the project.
All works again!
In my case the problem was with the filename: I accidentally (subconsciously) renamed it to .apk, when it should be .aab 🤦
following points are need to be taken care of while uploading file on
android market
"android:versionCode" attribute from AndroidManifest.xml is proper.
"android:versionName" attribute from AndroidManifest.xml is proper.
The package name is very unique,. Because all the apps on android market are separated by the package.
see all this is in place....
taken from while uploading file to android market error
I had this issue suddenly as well,
my solution was
flutter clean
flutter build apk
and it started working again
OPTION #1: Slow down an re-read every step. (Source).
Basic Setup for Signing.
Before you begin, make sure that the Keytool utility and Jarsigner
utility are available to the SDK build tools. Both of these tools are
available in the JDK. In most cases, you can tell the SDK build tools
how to find these utilities by setting your JAVA_HOME environment
variable so it references a suitable JDK. Alternatively, you can add
the JDK version of Keytool and Jarsigner to your PATH variable.
...
Eclipse Users
If you are developing in Eclipse/ADT (and have set up Keytool and
Jarsigner as described above in Basic Setup for Signing), signing in
debug mode is enabled by default. When you run or debug your
application, ADT signs the .apk file with the debug certificate, runs
zipalign on the package, then installs it on the selected emulator or
connected device. No specific action on your part is needed, provided
ADT has access to Keytool.
OPTION #2: Test the features required by your application with an unsigned '.apk'. (Source).
You can use the aapt tool, included in the Android SDK, to determine
how Google Play will filter your application, based on its declared
features and permissions. To do so, run aapt with the dump badging
command. This causes aapt to parse your application's manifest and
apply the same rules as used by Google Play to determine the features
that your application requires.
To use the tool, follow these steps:
First, build and export your application as an unsigned .apk. If you
are developing in Eclipse with ADT, right-click the project and select
Android Tools > Export Unsigned Application Package. Select a
destination filename and path and click OK. Next, locate the aapt
tool, if it is not already in your PATH. If you are using SDK Tools r8
or higher, you can find aapt in the /platform-tools/ directory.
Note: You must use the version of aapt that is provided for the latest
Platform-Tools component available. If you do not have the latest
Platform-Tools component, download it using the Android SDK Manager.
Run aapt using this syntax:
$ aapt dump badging <path_to_exported_.apk>
compile it & export the project under Linux (eclipse)
switch to InteliJ Studio (recommended)
It seems that from time to time there is a problem with eclipse under Windows 7,8.
flutter clean && flutter run
also works
I'm using VScode.
What happened:
After dart update, there was a permission error on flutter.bat
Solution:
Locate flutter.bat and give Full controll.
Open a cmd with Admin privileges, locate the folder that you are doing the development.
use 'FLutter clean' command (do not use vscode Terminal)
rerun app using 'Run without debug'
run flutter clean then flutter pub get. Then run your application, it should work
Error while run xamarin.uitest on using android sdk build tools 29.
Problem solved by changing android sdk build tools to 28.
I have same problem and solved by deleting all folders containing apk files in the location -
D:\FLUTTER\MY PROJECTS\SAMPLE\myapp\build\app\outputs.
if any folder is found access denied then force delete the folder or restart your system and try deleting the folder, then rebuild the app. It will work.
Go to the directory build/app/outputs/apk/debug , and the directory build/app/outputs/apk/flutter-apk . Erase the present files, once the compilation has run these files will rebuild and the error will disappear!

Upgrading Phonegap Android from 2.5 to 2.6 and 2.7 step

Hi I have problem upgrading Phonegap from 2.5.0 to 2.6.0 and 2.7.0 and specifically with step 8. I'm following the steps from the documentation Upgrading Cordova Android
Copy files from bin/templates/cordova to the cordova directory in your project
Where should I put those files, so they could upgrade my project?
The Android Phonegap conversion docs have changed significantly. There's no longer a step by step process that walks through each upgrade requirement. Instead, theres an "update" program that theoretically does the upgrade automatically. It didn't exactly work this way for me. After going through the documented update process (one step now) I had to go through my project and make sure everything was in place - specifically the cordova-2.7.0.jar and the cordova-2.7.0.js files.
I've just finished upgrading an Android project from Phonegap v2.5.0 to Phonegap v2.7.0. The process I followed was:
Back up the Android project.
Execute the Phonegap update command for v2.7.0 as described in the PG upgrade documentation
Change the current directory to Phonegap for Android directory:
$ cd /phonegap-2.7.0/lib/android
Execute the update command:
$ ./bin/update YOUR/CORDOVA/PROJECT/DIR
Ensure that Eclipse is referencing the correct Phonegap library in the libs directory: cordova-2.7.0.jar.
I also deleted the reference to the previous jar file.
Make sure that the phonegap javascript file (cordova-2.7.0.js) is referenced appropriately in the index.html file.
From within Eclipse: Project/Clean
Build the project and test.
I'm also trying to upgrade from 2.5.0 to 2.7.0 and running the update.bat file gave me the following message: Missing one of the following: JDK: java.oracle.com Android SDK: developer.android.com Apache ant: ant.apache.org – Etienne Desgagné May 27 at 2:15"
You need to check your 'path' System Variables in Environment variables under advanced system settings. JDK is the Java Development Kit and you check if it's correct by 'echo %JAVA_HOME% in a terminal. Ant is an apache thing and again you check that's correct by 'echo %ANT_HOME% and then you just need to make sure your Android SDK folder is in the path variable.

How to debug android project from git using Jenkins frontend?

I have installed Jenkins on my ubuntu 11.04 system using command "apt-get install jenkins".
I am able to executes "ant debug" command from linux command line well and completed successfully But when i am trying to debug Android project from git hub using jenkins frontend by setting build target "Invoke ant" with properties "sdk.dir=/opt/android-sdk-linux-ics". It is giving following error Console Output :
########################################################################################
Started by user anonymous
Building in workspace /var/lib/jenkins/workspace/touchanimtn
Checkout:touchanimtn / /var/lib/jenkins/workspace/touchanimtn - hudson.remoting.LocalChannel#72cd429b
Using strategy: Default
Last Built Revision: Revision 3e4b580644fad8b059fb5c13925d3d86fa402187 (origin/HEAD, origin/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from https://github.com/ssamar/touchanimtn.git
Seen branch in repository origin/HEAD
Seen branch in repository origin/master
Commencing build of Revision 3e4b580644fad8b059fb5c13925d3d86fa402187 (origin/HEAD, origin/master)
Checking out Revision 3e4b580644fad8b059fb5c13925d3d86fa402187 (origin/HEAD, origin/master)
Warning : There are multiple branch changesets here
[touchanimtn] $ ant -Dsdk.dir=/opt/android-sdk-linux-ics clean debug
Buildfile: /var/lib/jenkins/workspace/touchanimtn/build.xml
BUILD FAILED
/var/lib/jenkins/workspace/touchanimtn/build.xml:83: Cannot find /opt/android-sdk-linux-ics/tools/ant/build.xml imported from /var/lib/jenkins/workspace/touchanimtn/build.xml
Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
###################################################################################
I also tried by putting "android-sdk-linux-ics" into home folder but gave same error.
Please, Give me the correct solution for this error.
Either the root of your Android SDK isn't at /opt/android-sdk-linux-ics (i.e. the tools directory should be in there, with no intermediate directories), or the SDK does exist there, but the jenkins user doesn't have permission to access it.
This is a good question that more people will face when installing Jenkins on a linux system where the android SDK was installed before.
The problem is either that the path to the android SDK is not correct (1) or insufficient permissions for the jenkins user to access the android SDK installation path (2).
1) Path: Double check the path on your ant build step for the failing jenkins project. Go to the ant build step and click advanced. There it should have sdk.dir=SOME/PATH listed in the properties field. For multiple values make sure you expand the field and use a new line per value. Also don't include the -D to your argument since Jenkins will do that for each line.
2) Permissions: Double check the permissions on the android-sdk folder listed there. Use ls -l to get a list of current permissions and chmod to update the permissions if needed.
Notes:
It's always a good idea to switch to the jenkins user on your system and test the failing commands from the shell yourself.
sudo su jenkins
I had this kind of error also when I enabled security on my jenkins configuration. You can disable security without loosing settings by stopping the jenkins service, renaming the config file and restarting the service.
sudo service jenkins stop
sudo mv /var/lib/config.xml /var/lib/config.xml.backup
sudo service jenkins start
I didn't check in depth what user should get permissions in that case but I know reverting this change fixed the issue. Also I could still execute the ant scripts with the jenkins user as listed before.
This questions is very similar: Building android project from jenkins under linux - build fails, cannot find imported build.xml
Might help someone.
Wherever ANDROID_HOME/platforms pointing to
Reach in finder
bring get info
add Jenkins user and
give read access.
This solved my problem of build.xml not found error.

Building Android SDK: Only one Android target being created

Edit: I know I can download the SDK easily, but I specifically want to build everything myself. I'm trying to understand the build process more.
I used repo to download the AOSP source. Multiple places guide me to build the SDK as follows:
$ cd $AOSP_ROOT
$ . build/envsetup.sh
$ lunch sdk-eng
$ make sdk
This works perfectly, I get a zip file with the SDK and the emulator works. However, the only Android target that is generated is the latest one e.g.
$ cd $SDK_ROOT/platforms
$ ls
android-4.0.4.0.4.0.4
is all I see. How can I get the other Android targets? Do I have to use repo to switch the branch of Android that I'm on, build the entire SDK and just copy out the appropriate target files? Is there some simpler way, like a different make target that would achieve this? Can I request that the SDK be built and that all targets be available? Should I just download a non-locally-compiled SDK and copy the targets to my SDK_ROOT/platforms?
You need to use repo tool to switch to the appropriate branch and build your SDK for this branch. I do not think that it is possible to build SDK for all branches simultaneously.

Categories

Resources