I am thinking of writing a simple app with Python+Kivy, mostly for my own use - nothing fancy. For development, I would like to be able to
Compile the app into a package
Run it on an Android emulator
Sadly, at the moment I cannot quite close the loop - and googling didn't help.
I believe I downloaded all the relevant tools: Kivy, buildozer, Android SDK. I typed in the Kivy 'hello world' app, and it runs fine without Android emulation - unfortunately, when running it under the emulator (with suggested architecture x86), I get an error INSTALL_FAILED_NO_MATCHING_ABIS. If I make an emulator device with an ARM architecture (which is pretty slow to run), I can at least install the app on the emulated device - but it crashes once loaded. Error message is not informative.
I am guessing somehow I need to build the package for the native x86 architecture (?) which is the recommended default emulator in the Android emulator wizard - is that right? If so, how do I do it with buildozer tool? Or maybe I can run it on the ARM architecture, without it crashing?
Some finer detail:
I am running on OSX
I am building the package with the suggested command buildozer -v android debug
To install the app, I drag it onto the emulator window (there probably is a better way..?)
The emulator is the one coming with Android SDK, I'm emulating the default 'Nexus 5X' phone
Android SDK version is 23
I suggest trying to install the app on a real device and connecting the device to your pc in debug mode and use adb logcat to get the log of the device to know what is causing the error. This way you can make sure if the problem rises from your code or your emulator environment.
Your setup sounds fine, the immediate problem is entirely the architecture (although the crash on your ARM emulator suggests that your app has a bug, which you can debug by checking out the logcat log).
python-for-android supports x86 and will work on the emulator this way. You can use this with --arch=x86. However, buildozer does not currently expose this option (it hardcodes armeabi-v7a). This wouldn't be difficult to fix, feel free to open an issue in the buildozer github repository about it.
I'll note that if you have a device available, debugging using that isn't really any different (or slower/faster) than using the emulator. Buildozer/python-for-android can push the apk and run it automatically, and viewing the logcat output works the same in both cases.
Related
I am currently learning how to develop apps on Android in Java, and I'm right now I'm attempting to build and install programs from the command line (without Android Studio). Right now, I'm using gradle to build and install a program to an emulator. The problem now is that my app is crashing immediately and I have no idea why. The gradle command gradle installDebug just installs the app and terminates. The emulator command emulator -avd Nexus_5X_API_28 -verbose similarly gives me a bunch of useful information at startup but is completely silent while my app crashes. I'm wondering how exactly I'm supposed to see the stack trace resulting from the crash.
There's a program bundled into the Android SDK (or maybe it's installed automatically by Android Studio, I'm not sure) called the Android Device Monitor. By default, it can be accessed by running ./pathToSdk/tools/monitor. And from there you have the same windowed thing that used to be used in older versions of Android Studio. It's not a pure command-line solution, and it may require installing Android Studio beforehand, but it works very well.
I decided to give Xamarin a try. So I followed the various articles at https://developer.xamarin.com/guides/cross-platform/getting_started/ to install Xamarin, then build an Android app. That was pretty easy, especially since I already have Visual Studio 2017 installed. The code compiled fine. I set up an Android Virtual Device and tried to debug/run the app in that AVD. Everything I've tried results in:
Build succeeded.
Unexpected install output: Error: Could not access the Package Manager. Is the system running?
Deploy failed on ...[AVD device here]
I have VS 2017 running on Windows 10.
The development experience was encouraging, since I've been using VS/C# for such a long time now, but getting past this emulator issue has, so far, been a complete roadblock. Any help would be appreciated.
Could not access the Package Manager. Is the system running?
Are you using ARM based emulator ? They are extremely slow and take lots of time to boot up. As Anubhav Ranjan said, just wait until emulator be loaded completely, once it finished it should work.
Try using an x86 based emulator, and use the Hardware Acceleration. Those run much faster, still a little on the slow side, but bearable.
I've just started a blank Cordova project on Visual Studio 2015, the intention being to use it to develop mobile apps in the future. I've been able to get it to run in the emulator on Android and even onto an iOS device (through a Mac), but I haven't been able to figure out how to run straight onto a WP8.1/Android device, or on a WP8 emulator. When I try, I get this message:
Error running one or more of the platforms: Error: cmd: Command failed with exit code 2
You may not have the required environment or OS to run this project
The Android device also says, above that:
ERROR: Failed to deploy to device, no devices found.
There's very little documentation online, and because it's all so new, Google hasn't been particularly enlightening. It's possible that I'm missing some software, but I don't know what.
For the devices, it could be that I'm supposed to select the device from a list somewhere, but I can't see anywhere that could be. For the emulator, I'm assuming I'm missing software, or a setting is wrong on my PC, but have no idea what it could be.
To fix the issue with WP8:
I had been playing around with different versions of VS... un-installing and re-installing 2013 and 2015 and eventually hit the same issue as you.
The solution here worked for me:
No Emulator lists to deploy windows phone app
I do not have an android phone to test with t the moment, so I have not seen the android device issue.
I'm normally testing my android app on a physical device, but today I want to do some testing using an emulator. So I created one and it's running fine. I now want to install my app on my emulator. I normally install the app on my device using the Gradle task "installDebug". In the list of Gradle tasks I can't find anything which refers to the emulator though. Although this should be an easy thing to do, I can't find any place in Android Studio to do this.
So I found this question here on SO which explains a way to do it from the command line. Although I'm not afraid of the terminal it would be great if I can just do it from within Android studio/IntelliJ so it goes quick and easy.
Any tips on how to install my app on the emulator from within Android Studio (either using a Gradle task or not) would be great!
Emulator instances act just like physical devices for the purposes of the installDebug task in Gradle, in ADB, and the Android Debug Monitor. If you only have an emulator running and no physical device connected, most things will simply use the emulator by default without needing to ask you; if you have an emulator as well as devices, then you may need to choose which one to use in the same way you would if you had multiple physical devices.
Using Intellj-idea I'm trying to debug into the Android source API 17 but when I set breakpoints in the platform source they are being ignored when run. Looking at the breakpoint whilst debugging there is a cross in it with a message stating "no executable code found at line 15,508 in class android.view"
I've tried running against an emulator with API 17 set as well as a phone with Android 4.2.2 but both don't work. I can sort of debug into the methods but the cursor jumps around.
So I'm guessing that there is no debug info as well as some optimisations that have gone on. So my question:
Is there a way I can properly debug the Android Platform from the perspective of my application and set breakpoints that work in it? Maybe a an emulator that has been been built with debug info?
Any help would be appreciated?
Regards
Lee
It depends on what application you are trying to debug: your own application, a system application such as android.process.acore.
To debug platform source running in your own application
The main issue is the line numbers of the platform source you have downloaded on your computer must match what is running on the device. Your best bet will be to debug on Google Nexus device such as the Nexus 5 or Nexus 7 since it should be running a compiled version of the source exactly as it was released by Google which you downloaded with the Android SDK. Just add the sourcepath to the sdk in IntelliJ, attach the debugger and set the breakpoint. Make sure you choose the same API level source as is running on the device. That should do it.
To debug platform source running in a system application
You will need eng build of the Android platform to debug system processes. If you haven't built and installed the Android platform before it is quite a bit of work and requires an unlocked bootloader. Maybe there are prebuilt eng builds of cyanogenmod or something that can be downloaded but I can't find any after some trivial Googling. You may also make an eng build of AOSP yourself and run the emulator on your machine. See Running emulator after building Android from source and the "Choose a target" section on the AOSP site for info on building your own eng build if you are feeling very ambitious.