Android change development environment - android

Currently I am using Eclipse IDE with ADT plugin for my Android application development, but when I change the same source code to another machine with same IDE and ADT Plugin, the generated APK cannot be installed as upgrade, android show a error message (I don't remember the error message)
Since that error, I use the original IDE to compile an APK and finally upgrade on the installed devices.
What I need to add/change in other machines to avoid install errors?
Thank you.

You need to use the same keystore to build your app when you test.
Android: keytool error on the command line when locating debug.keystore
or on a Mac:
How to find ~/.android/debug.keystore in Mac OS X for Android?
Copy the debug keystore from one machine to the other. You may want to make a back up if you have multiple projects that you are debugging, but you should probably just migrate to a common key.

The apk generated will have a different key therefore it cannot be installed as an update.

Related

Xamarin android App Deployment failing with error "apksigner.BAT" exited with code 2

Xamarin App Deployment failing with error "apksigner.BAT" exited with code 2 .
JDK version 1.8.162
Try downgrading the JDK to 1.8.131.
i faced the problems with 1.8.161 and 1.8.162.
If u are using JDK 9, then downgrade to JDK-8
Uninstalling JDK 9.x fixed it for me.
That Android Settings were pointing a JDK 8.x made no difference. JDK 9.x had to be removed to fix the issue.
I got the same error when building a Xamarin.Android app on Visual Studio.
It was caused by having migrated my keystore from JKS to PKCS12 format because
keytool.exe -list -v -keystore <path to my keystore>
kept giving me the following Warning: The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format.
Bad idea to migrate, it appears apksigner.BAT requires the keystore be in the JKS format. I solved this issue by reverting back to my debug.keystore.old
In addition to JDK related answers above which is correct, also try to check PATH variable. There have to be latest installed JDK version. Solved my problem after days of checking different IDE's, machines and devices.
As others found, it's a conflict that occurs when you have a newer version of Java installed, such as JDK 9.
This shouldn't really be necessary but here is a workaround: Create a new batch file with the below content (update paths as necessary). You want to set JAVA_HOME so it points to the older version of Java.
Xamarin.bat:
#echo off
set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_161
set PATH=%JAVA_HOME%\bin;%PATH%
cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\"
start devenv.exe
I recently get an old poject from a client. It was giving same error in Visual Studio for Windows. In Visual Studio for Mac it was giving 1 error without displaying any Error Message.
The reason behind the error was that the client have specified a signing key which is not available on my system.
On Mac I just have to uncheck the apk signing option.
while on Windows I have to edit the csproj file to remove the signing key. Now the project builds successfully.
For me worked removing (or renaming) apksigner.bat from my current build tools directory (...AppData\Local\Android\android-sdk\build-tools\28.0.0-rc1\apksigner.bat)
After then, cleaned obj and Debug/Release directory->Rebuild->Deploy

signing and aligning apk step: No matching files were found with search pattern

Recently I created a pool agent to automate a build definition for Xamarin Forms (Android) in TFS. Although almost all steps run succeded, signing and aligning apk step throws an error:
According error, no apk is found in C:\agent_work\1\b\release*.apk, however during building process I went to folder to check it out and I found the file:
I'm not being able to understand why error. Please need your help! Here build definition for step:
I solved it:
Signing process of the APK files depends on the Java tool called jarsigner. The java compilations that my Xamarin projects do in Visual Studio are done using JDK 8 (Jdk 1.8.0_111), however when reviewing the JDK version with which the Team Services Build Agent compiles, it depends on the variables of Environment that it recognized from the system and registered them in the capabilities when installing the agent in Team Services. %JAVA_HOME% was using the JDK 7 build path, different from the one used by Visual Studio for the same solution:
Visual Studio solution:
I actually have two Java versions installed on my PC, and because the SYSTEM CAPABILITIES have been built into Visual Team Services since the agent was first installed, it recognized the path configured in the environment variables of the operating system for %JAVA_HOME%, So it was necessary to adjust the path of this variable, uninstall the agent and reinstall it again. Subsequently the compilation already generated other errors: JAVA_HOME is not set, ANDROID_HOME is not set. This was solved by adding them as predefined variables in Team Services:
And That's it! Successful building:

cordova 5.0 generate signed apk

I use Cordova 5.0.0 to develop android app and I would like to run the app on real machine.
I tried two ways to generate signed apk but failed,
One is used command line to sign an apk that generated by cordova. by this way, it will cause "parsing error" when install the apk;
The second way I tried is using android studio to generate signed apk. My step is "import non-android studio project" then generate signed apk. By this way, I install successfully but the app can't be open and popup error info "unfortunately, xx has stopped".
There is no problem with the code.
Anyone can give me some suggestion? Thanks.
Cordova 5 uses gradle to compile now, so the old ant.properties no longer works. You can work the same trick by creating a release-signing.properties file in platforms/android and adding the following:
storeFile=<path to="" .keystore="" file="">
storeType=jks
keyAlias=<your key="" alias="">
// optional :
keyPassword=<your-key-password>
storePassword=<your-store-password>
If you used Android Studio, you can try with Intellij IDEA (Android Studio is performed by Intellij Platfrom ) here.
After importing your projet, simple go to :
Build > Generate Signed APK..
You'll need to create a key and then Intellij will create your APK.
If you still have your error "unfortunaly..." connect your device and check Intellij logs.

How do I put my cordova application on the android play store?

If there is official cordova documentation for this, I couldn't find it and would appreciate a link. I have run cordova run android to deploy to my phone. Things look good. Now I'm ready to turn this into an official app that users can download on the android play store? When I build my app it generates a file named "CordovaApp-debug.apk". That "debug" part makes me think this is the wrong file to work with, but I'm not sure how to generate the right file.
Deploying a hybrid app to the Google Play Store
These steps would work for Cordova, PhoneGap or Ionic. The only difference would be, wherever a call to cordova is placed, replace it with phonegap or ionic, for your particular scenario.
Once you are done with the development and are ready to deploy, follow these steps:
Open a command line window (Terminal on macOS and Linux OR Command Prompt on Windows).
Head over to the /path/to/your/project/, which we would refer to as the Project Root.
While at the project root, remove the "Console" plugin from your set of plugins.The command is: cordova plugin rm cordova-plugin-console
While still at the project root, use the cordova build command to create an APK for release distribution.The command is: cordova build --release android
The above process creates a file called android-release-unsigned.apk in the folder ProjectRoot/platforms/android/build/outputs/apk/
Sign and align the APK using the instructions at https://developer.android.com/studio/publish/app-signing.html#signing-manuallyAt the end of this step the APK which you get can be uploaded to the Play Store.
Note: As a newbie or a beginner, the last step may be a bit confusing as it was to me. One may run into a few issues and may have some questions as to what these commands are and where to find them.
Q1. What are jarsigner and keytool?
Ans: The Android App Signing instructions do tell you specifically what jarsigner and keytool are all about BUT it doesn't tell you where to find them if you run into a 'command not found error' on the command line window.
Thus, if you've got the Java Development Kit(JDK) added to your PATH variable, simply running the commands as in the Guide would work. BUT, if you don't have it in your PATH, you can always access them from the bin folder of your JDK installation.
Q2. Where is zipalign?
Ans: There is a high probability to not find the zipalign command and receive the 'command not found error'. You'd probably be googling zipalign and where to find it?
The zipalign utility is present within the Android SDK installation folder. On macOS, the default location is at, user-name/Library/Android/sdk/. If you head over to the folder you would find a bunch of other folders like docs, platform-tools, build-tools, tools, add-ons...
Open the build-tools folder. cd build-tools. In here, there would be a number of folders which are versioned according to the build tool-chain you are using in the Android SDK Manager. ZipAlign is available in each of these folders. I personally go for the folder with the latest version on it. Open Any.
On macOS or Linux you may have to use ./zipalign rather than simply typing in zipalign as the documentation mentions. On Windows, zipalign is good enough.

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!

Categories

Resources