Android Jenkins Builds - android

I am developing Android apps on Windows platform. I can create and build android apps using command-line tools successfully on the local machine without a problem.
I decided to use Jenkins to build apps remotely. I could succefully created a windows slave and created a test app using command line tools. But I can't get it to be emulated remotely with this :
C:\Dev\workspace\com.this.test\cordova\cordova.bat
This line works locally, but if I use it on Jenkins, it produces this error.
c:\Dev\jenkins\workspace\buildtest>C:\Dev\workspace\com.this.test\cordova\cordova.bat emulate
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
You don't have any Android Virtual Devices. Please create at least one AVD.
android
Build step 'Execute Windows batch command' marked build as failure
EDIT:
If I run the following command locally,
%comspec% /c android.bat list avd
it lists the AVDs like below.
Available Android Virtual Devices:
Name: ap16
Path: C:\Users\tt\.android\avd\ap16.avd
Target: Android 4.1.2 (API level 16)
ABI: armeabi-v7a
Skin: WVGA800
But if I send it via Jenkins it says nothing but :
Available Android Virtual Devices:

Did you create an emulator on the remote machine? i.e. Via the android create avd command line, or using the SDK Manager tool.
More simply, you can also install the Android Emulator Plugin to automatically handle creation of emulators.
Edit, after more info was provided:
Emulators created are per-user — they're not shared between all users of a machine.
Presumably you're running Jenkins as a different user, e.g. the system user by running Jenkins as a Windows service. Therefore it sees a different set of emulators as you do when logged in to your account.
I would still recommend using the emulator plugin, so that Jenkins can create its own emulators when it needs to (though note the "Known Issues" about running as a Windows system account). Alternatively, you can probably create the emulators manually as the Jenkins account, or change the Jenkins service to "run as" your regular user.

Try to install Android Emulator plugin, but I also faced issue with the latest version of this plugin and there is no option to downgrade it.
I tried to create virtual device in Jenkins and also tried to use existing virtual device - errors in both cases...

Related

no device in android studio with flutter

I installed the Flutter correctly and added it in the environment variables and also added Dart
I added an emulator and ran it before creating a project as a kind of experiment
When I create a project, it does not give me the device
As shown in the pictureenter image description here
To prepare to run and test your Flutter app on an Android device, you’ll need an Android device running Android 4.1 (API level 16) or higher.
Enable Developer options and USB debugging on your device. Detailed instructions are available in the Android documentation.
Using a USB cable, plug your phone into your computer. If prompted on your device, authorize your computer to access your device.
In the terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device.
Start your app by running flutter run.
By default, Flutter uses the version of the Android SDK where your ADB tool is based. If you want Flutter to use a different installation of the Android SDK, you must set the ANDROID_HOME environment variable to that installation directory.

How to install AVD on VS code?

The error is saying that:
"No suitable Android AVD system images are available.You may need to install these using sdkmanager, for example:
sdkmanager "system-images; android-27; google_apis_playstore;x86"
Can someone help me out with it?
Thanks a lot!
How to SetUp Emulator For VSCode?
From version 2.13.0 of Dart Code, emulators can be launched directly from within code but This feature relies on support from the Flutter tools which means it will only show emulators when using a very recent Flutter SDK. Flutter’s master channel already has this change, but it may take a little longer to filter through to the dev and beta channels.
We have tested this feature and worked very well on flutter version 0.5.6-pre.61
You do not need Android Studio to create or run a Virtual Device. Just use sdkmanager and avdmanager from the android sdk tools.
Use the sdkmanager to download a system image of Android for the x86 system. e.g. sdkmanager “system-images;android-21;default;x86_64
Then create a new virtual device using avd manager. e.g. avdmanager create avd –name AndroidDevice01 –package “system-images;android-21;default;x86_64”
Then run the new virtual device using the emulator. If you don’t have it just install it using the sdkmanager. e.g. emulator -avd AndroidDevice01
If you restart VSCode and load your Flutter project. The new device should show up at the bottom right of the footer.
For those people using a Mac, you can go to your terminal and type
$ open -a Simulator.app
and this command will open the simulator. After that, just go to the Debug option and tap on “Start Debugging”
If you want to test with an Android Emulator:
What I did was to go first to Android Studio and open a virtual Device with AVD Manager. After that, you’ll see other devices in your Visual Studio Code.
In the bottom right you’ll see now that you have 2 devices connected. Now, you can test with any of these devices.
So You can use the ‘Android iOS Emulator‘ plugin and Add the Android Studio Emulator script to your settings in Visual Studio Code:
Mac:
emulator.emulatorPath": "~/Library/Android/sdk/tools/emulator
Windows:
emulator.emulatorPath": "<your android home>\\Sdk\\emulator\\emulator.exe
Linux:
emulator.emulatorPath": "~/Documents/SDK/tools
Your visual studio code settings are found here: File -> Preferences -> Setting -> User Setting -> Extensions -> Emulator Configuration. Open command palette Cmd-Shift-P -> Type Emulator.
ctrl+shift+p
then type:
Flutter:launch emulator
run this command in your VS code terminal flutter emulators then see the result if you have installed any emulator it will show you, then to run one of them use flutter emulators –launch your_emulator_id in my case flutter emulators –launch Nexus 6 API 28 but if you haven’t installed any emulator you can install one with flutter emulators –create [–name xyz] then run your project flutter run inside the root directory of the project.
You can review the full answer from the following link

Cannot Install ARCore on Android Emulator

I understand this question has been asked a few times, however the solutions for the other users have not resolved my issue. I am attempting to install ARCore on my Android Studio emulator. The Play Store says "Your device isn't compatible with this version," and when I click and drag the ARCore for emulator APK to manually install it on the emulator, it gives me the following message: "The APK failed to install. Error: Could not parse error string"
The System Image I'm using: Oreo/ API Version 27/ABI x86/Android 8.1 (Google Play)
I have set the OpenGL ES API level to Render Maximum, and its version is showing up as OpenGL ES 3.1.
I have tried every solution I could find on here and have had no luck. Has anyone else had this issue or can you offer any suggestions?
If your smartphone doesn't support ARCore or you have no phone but need to debug an AR app – Android emulator is a great way to do it.
Follow these steps to install Android Virtual Device (AVD):
Make sure Android Debug Bridge (adb) is installed and works properly.
Download the latest ARCore_emulator.apk from GitHub.
Choose AVD using menu Tools > AVD Manager and run it.
Type this command in Terminal while the virtual device is running:
adb install -r ARCore_1.8.0.x86_for_emulator.apk
Repeat previous steps for additional AVDs you’d like to use on port 5554.
If you need more detailed information, please read THIS POST.
Followed Andy's Answer as follows:
Make sure adb is installed by typing adb at any terminal. *
1) Downloaded Google_Play_Services_for_AR_1.14_x86_for_emulator.apk from Android SDK Google Services (download it from latest release)
2) Copied this ***_x86_for_emulator.apk to the project root folder
3) Create new or Edit/Update existing Emulator with the instructions on the docs: How to create an Emulator with ARCore Support
i.e you must have emulators settings done.
4) Run the emulator
5) Open the terminal at Project Root (or anywhere you copied the ***_x86_for_emulator.apk file) and execute:
adb install -r Google_Play_Services_for_AR_1.14_x86_for_emulator.apk or
adb install -r <name_x86_for_emulator>.apk
5) Now run the project on same emulator. You can update rest of the emulators with these steps, providing that they have settings as given in Step 3.

Is it possible to create and maintain Android Virtual Devices WITHOUT installing Android Studio?

The development I'm taking on is written in TypeScript/JavaScript, and all the instructions left behind use TNS (Telerik NativeScript) command lines to build, debug and publish the apps, for both Android and iOS.
Setting up my Windows PC with Visual Studio Code, Node.js, NativeScript, and the Android SDK, I have got to the point where I can build the application using > tns build android but I cannot run it as I have no devices.
Going back to the NativeScript instructions, it does clearly say that an Android Virtual Device is needed, but the link takes me to how to setup an AVD using Android Studio.
Well, I do not want to install another IDE just to be able to manage AVD's. I'm familiar with VS Code, all the original development was done in VS Code on iOS, and all the documentation, including screenshots, are from VS Code.
Supposedly, there is an AVDManager.exe in C:\Android\android-sdk\tools\bin\, but there certainly isn't in my installation of the SDK.
> emulator -list-avds shows nothing.
> tns device android --available-devices also lists no available emulators.
Embarcaderos' RAD Studio includes an Android emulator, but I'm using Delphi 10.2 Tokyo for desktop development, so don't have access to that emulator on this machine.
Is there any other way to create an AVD, so that when I type > tns run android from the working folder of the mobile app, it starts the emulator and runs the app within it?
You can download just the SDK command line tools via the android studio download page -> "Get just the command line tools".
The emulator program and the avdmanager should be everything you need to get an emulator up and running.

Trying to emulate android from Appcelerator on Windows

I installed Appcelerator on Windows, am trying to see android output.
I managed to add an android device by downloading - launching an android emulator called Genymotion. Now I have an IP address added to the Run menu, when I activate it Appcelerator tries to launch: console messages appear. But after 1minute or so I get a message saying I should download an SDK API level 23.
I had an old version of Android Studio, I updated it, opened its SDK manager tool and downloaded everything I could find, rebooted, but error persists. I can see Android version 23 in the list.
Here is the error message:
[ERROR] : No valid Android SDK targets found.
[ERROR] : Please download an Android SDK target API level 23 or newer from the Android SDK Manager and try again
I had the same issue recently and it turned out to be the java JDK missing from my path.
Take a close look at the Appcelerator environment variable documentation for windows.
Below are some java directories included in my path on my new Windows 10 machine:
C:\ProgramData\Oracle\Java\java;
C:\android-sdk-win\tools;
C:\android-sdk-win\platform-tools;
C:\Program Files (x86)\Java\jdk1.8.0_65\bin;
Also, I really suggest using GenyMotion (which I avoided for years) to run your emulators, turns out to be incredibly fast, easy to setup and they have free Basic Version.
Best of luck.
Now I have an IP address added to the Run menu
Studio should detect Android & Genymotion emulators and allow you to select from a list. No need to enter the IP. If you don't see the emulators, run appc ti info -t android to see if there's any issues that need fixing.

Categories

Resources