Using Maven the fastest way for running and debugging - android

I'm quite new to Maven.
Before using Maven, I had only two main single click buttons (and keys) that I've used: run and debug. Of course I have others, but those are things that I use a lot.
Now that I need to use Maven, I use some special commands. For updating the dependencies, compiling and running on the device/emulator, I use:
clean install android:deploy android:run
However, this also uninstalls the previous app.
For debugging, sadly I do what is written here (which doesn't allow debugging from the beginning, plus it has many more steps), or use Debug.waitForDebugger() (which requires me to change to code each time for toggling run and debug modes).
How can I have the same functionality of running and debuggsing as the normal ADT plugin?
Edit: about the uninstallation issue, the answer would be to set undeployBeforeDeploy to false instead of true.

Related

Default Android Studio compiler to offline, but also download things that's necessary

I am traveling in China for a few month and the network connectivity is weak due to the great fire wall. I have found enabling Offline work in Gradle setting super helpful. It reduced my compile time from a few minutes to a few seconds when I make a minor change in the build.gradle file.
However, I still need to manually turn it on and off if I introduce a new library to my project. So here comes my question:
Is there a way to default to Offline work and still download new library when needed?
you can use following build command from android studio terminal.
gradlew --offline assembleDebug

Xamarin.Forms - AOT compile not working (for Android)

This is the repository that demonstrates this issue.
This is simple standard project with one page. I created the archive for publishing (release mode).
If I use the "AOT compile" option, I get the error:
"Apk failed to install Error:could not parse error string"
If I disable this option, then the APK works.
To use my test project, update the option AndroidSigningKeyStore in ApkSignerIssue.Android.csproj to point to file test.keystore in the folder test.
I'm on Windows 10 and I'm using Android Api 26. If I try Api 25, it does not work. I've tried using VS 15.5.7 and 15.8.0(preview) with "AOT compile" and neither of those work.
Without this option, XF+Android can not be used; the first load of the app will take 8-10 seconds.
It worked earlier, but now I can not build a package to release an update to my application.
Downgrade to 15.5.7 working for me now.
I do not know why this did not work right away, maybe I rebooted the computer. but now it works.
That's good - I was able to release an update my app.
And this is very sad - this is my fourth Downgrade in three months(starting from 15.6).
Archiving the package does not work normally three months, three months, Karl!
I lost a lot of time.

How can I disable MultiDex in Android Studio?

I know how to enable MultiDex support, but my problem is the opposite.
Seems like my Android Studio's MultiDex option is enabled by default for some reason.
When I unziped the resulting APK file and checked inside, there were two files.
classes.dex and classes2.dex.
You may say my project may hit 64K limit, but no, it doesn't.
I also tried without any dependencies and with some other gradle settings,
but the result was all the same.
I even put the line multiDexEnabled false, but it didn't help either.
So this time I created another new empty project, and hit the Run button without any modification.
Result? Same.
As you can see, I have two .dex files with very low references.
I don't understand what's happening here..
The reason why I'm trying to disable MultiDex is,
First, my app is really simple with a few dependencies so just don't need it.
Second, the app needs to support even older Android OS.
Third, I want to avoid the Dalvik linearAlloc limitation in the old Android devices.
Finally, I want to know the exact cause of this.
One more fun fact.
I decompiled and looked into the the apk file, and couldn't find the class named MainActivity which was created by default while the app ran on my phone as expected.
The same is true for my real project. The app works well but there isn't my code in the classes*.dex. Yeah, it's fine if the app works without any problem, but it's somewhat annoying because I sometimes want to decompile and see the resulted code.
Things like Instant Run change the nature of the APK. What you get when you run the app from the IDE is different than what you get when you build the app by other means (Build APK(s) in the menu, gradle tasks, etc.).
This is one of the reason why I disable Instant Run, as I'm one of those crazy people who wants to run the same app that my users would run.
Android Studio 3.0 makes another change to the APK, compared to what your users will run: it adds android:testOnly="true", preventing that APK from being installed normally. Probably this is a safety measure, so that you only distribute APKs made through some other build mechanism.
In your case, based on the comments, it appears that Instant Run was what was causing the multidex-style behavior. That may be tied to how Instant Run attempts to patch an already-installed APK, rather than push the fresh APK to the device or emulator.
So, either disable Instant Run or don't analyze the Run output, but instead focus on APKs built by other means.

Debugging and Running a Mono-Droid application

I have been quite interested in developing an application for my Android device. I downloaded the all the required tools for VS2010 following this guide - http://mono-android.net/Installation/Visual_Studio and everything went pretty smoothly.
Now, the first time I ran the default application and it copied everything to the emulator, it ran perfectly. If I make a simple change to the application and hit F5 to redeploy - it starts the app, but it seems to have the old version on there still and doesn't show my changes. I've cleaned the solution and rebuilt the application, so I don't think its that. I've also completely changed the code (just in case it was something I was doing wrong), but that didn't work either. Oh and the build also succeeds!
Now the Emulator seems a bit flaky and slow...but is it something that I am doing? Is there somewhere I need to clear before hitting F5?
When it is doing the deploy, does it say "Uninstalling the previous version"?
Another thing to try is to manually remove the app from the emulator (Settings -> Applications -> Manage Applications -> -> Uninstall. Then deploy again and see if the new version is copying. This should narrow down if it's a deployment issue or a build issue.

Alternatives to compiling in Eclipse?

The following situation will surely be familiar to any Android developer using Eclipse and ADT.
I'm tired of this endless cycle of switching Build Automatically on and off, running Clean, building and running. I'm constantly doing all of these operations when I'm fine tuning UI (i.e., editing XML files and needing to see the results live), and any time I save, an Eclipse window telling me I have these pending operations shows up. When that happens, I turn off Build Automatically. I do my alterations and then run. Sometimes Eclipse decides the changes in the XML file weren't enough, and it won't reinstall the app in the emulator or device, so I force a build and install.
All of this is just wasted time. I've already done an AppleScript to build & run my app into all the emulators and devices I have connected at once, described in this SO question, but my workflow could be much improved if I found a way to save and build silently and fast.
Does anyone have any tips or alternatives?
IntelliJIdea Community Edition now supports Android
Have you tried the bundle for Textmate? It's pretty cool. It's basic but its got all the features you need. Building, Deployment and integration with AVD and Logcat.
I use this for all my Android Dev now as I found Eclipse painfully slow.

Categories

Resources