Take test app from android studio off of phone for use. - android

I recently deleted what I had in terms of an app from Android Studio due to ridiculously bad code. But, I had originally tested the app before the code went crazy. With that being said, I have that part of the app on my phone. Can I take the app off of my phone and put it into Android Studio and pick up where I left off on that? I've read that you can take an .apk and load it into Android Studio, I just don't know where to find it on my phone.

You can decompile the .apk, but you can NOT turn it into an Android Studio project. And if you enabled proguard when building, the decompiled .java files will be a jibberish.
What you should do is install a VCS like git (it is easy to setup and use) and commit your changes regularly. This way you will always be able to roll the project back in case of trouble.

In order to get access to the .apk file, you need to use a 3rd party app like appsaver or super saver to save the apk onto your sdcard or internal memory.

Related

How can I restore Nativescript application code from android device?

When I create an APK while developing a Nativescript application, Nativescript stores all the application code in the generated APK file, and that helps me a lot in case something bad happened to the code[The code was deleted, Didn't commit changes I was working on for a long time,...]. When something bad happens to the code, I usually generate an APK from my android device using any APK Extractor tool and decompile it with JADX to obtain my original code and save my day.
Nativescript doesn't generate NEW APKs when I make changes to layout or js files[even though changes are applied on the android device]. Nativescript generates new APKs only when I build the project. and that doesn't help a lot when I need to restore my code after a lot of changes on it.
We're working on a nativescript application. We've been making changes on the application for about two days without generating new APK nor committing changes to git. The files where suddenly removed from pc and we don't know why.
We extracted an APK from the latest working version on the test android device, decompiled it and retrieved the code but the changes of the last two days weren't there.
Is there a way to restore the code from a Nativescript application installed on android devices? By restoring the code I mean even restore all the changes on the code after building the application.
Where/How does nativescript store the instant changes on the code for my application on the android device?
You can view your code by accessing the application data from adb.
connect to your application from adb
adb shell run-as org.nativescript.myapplication
and you can find your files in this directory
/data/data/org.nativescript.myapplication/files/app
It's not wise to depend on your APK for retaining your source code, you should probably use a Version Control System like Git, may be services like Github / BitBucket / GitLab etc., to maintain your source code.
While using a Version Control System, you should commit your changes regularly. That's the whole purpose here, even if you are not sure about your changes you can still use your own branch and keep the changes committed and merge to main branch only when it's fully ready.
I guess you are not using the --bundle option while you run / build the app which is recommended to keep your application lightweight at same time provides a minimal obfuscation using Uglify. With next major release of NativeScript this --bundle option will be marked as default, so you will no longer be able to extract your exact source code at all.
Also think if someone wants to hack your app while you haven't followed any obfuscation, it's easy to clone your work Or break the functionality as they wish. Learn more about securing your source code here.
Still regarding where the live changes are being stored, I think it will be within application data directory on Android.

Elegant classes loading and updating system

In the current state of the project I'm currently working on, I have a classic Android Studio project with a classic app on it.
For some good reasons (it's an embedded app), I would like to include an auto-update feature in the app, which doesn't require to exit it (I must stay inside the app or another app and never show the underlying Android system).
I have two solutions to do this :
Create another "updater" app which updates the app using the package manager command. It requires a rooted device to work, but it would suit my needs : when an update is available, the main app closes itself and opens the updater app which updates the main app and starts it back
Have the actual code of the application stored to the external storage and turn the APK into a bootstraper which downloads and runs the app
The later solution is the better one since it doesn't require a rooted device.
This is why I would like to write an elegant system to achieve this ; the development of the app should not be crippled by this (e.g. I don't have to upload the new classes at each build, I don't need to do extra voodoo work to add activities or permissions to the manifest...).
I thought of using the build variants of Android Studio :
Debug variant : build the app like usual, don't use the bootstraper
Release variant : don't include all the classes in the APK, build an external JAR which contains them and use the boostraper in launcher intent
I saw how to load external classes from the external storage, but I couldn't find anything on how to externalize the whole app code, including activities. I have the feeling that we just can't.
Would such a system be possible to develop ?

How to install java/android package from github onto my android device?

I'm not an android developer and don't really know anything about it so forgive me if this is a silly question. Basically, I've come across an android package that is supposed to support the correct display of Arabic letters on android devices. Here's the link: https://github.com/agawish/Better-Arabic-Reshaper
Now, all I see are two java files that I can download. But how am I supposed to install this package? Do I need root access to my android device? Is there a directory that I need to put them in? There's no tutorial or guide in the readme file.
But how am I supposed to install this package?
Step #1: Learn Android development.
Step #2: Create an Android application.
Step #3: Contact the author of that code to get a license for it, as it is not open source.
Step #4: Add the code to your application and use it to fix the Arabic behavior in your app. Note that this may not be needed on newer devices, and may actually have issues on newer devices, given changes in bi-di text handling.
Do I need root access to my android device?
I doubt it.
Is there a directory that I need to put them in?
Somewhere in the src/ of your Android application project on your development machine.
This code is not an Android app, nor is it designed to do anything for an entire device.

Developing customized version of built-in SMS/MMS Android Application

Okay, here's the situation:
I'm developing an application for a client (or trying to do so). It requires much (if not all) of the same functionality as the built-in SMS/MMS application. So, I thought - HEY! Android is open source right? I can take the application and modify to my needs, right?
So, I found the code on github for the MMS/SMS application (for some reason, based on the AndroidManifest file, it calls my project I built, "ConversationList"). But I get TONS of errors involving the import com.google.android.mms.* package and a couple other packages.
Everyone keeps saying "it's a private/internal package", and "download the entire AOSP". But, HOW do I do this on Windows, and WHY can't I just download the appropriate packages to use in the program?
ALL I want to do is build a project in Eclipse deploy it to my phone, and then modify the necessary code. If Android is open source, why so many secret/internal packages? This is frustrating.
Any advice?
So, I found the code on github for the MMS/SMS application (for some reason, based on the AndroidManifest file, it calls my project I built, "ConversationList"). But I get TONS of errors involving the import com.google.android.mms.* package and a couple other packages.
AOSP applications like this are designed to be built as part of a firmware image, not as standalone apps.
But, HOW do I do this on Windows
Most likely, you don't. Cygwin might work. More likely, you will need to use OS X or Linux, such as running Linux in VirtualBox. And the result of your build will not run on anything, except as part of a firmware build that you use to replace the firmware on a device.
WHY can't I just download the appropriate packages to use in the program?
Because that application is designed to be built as part of a firmware image, not as a standalone app.
ALL I want to do is build a project in Eclipse deploy it to my phone, and then modify the necessary code.
Then find a project that is designed to be built as a standalone app as your starting point. Or, work on modifying the project you are trying to use to work as a standalone app, by ripping out all the functionality that depends upon things that are not in the app itself.
If Android is open source, why so many secret/internal packages?
They are not "secret". They are part of the firmware.
For example -- since you appear to be familiar with Windows -- it is entirely possible that "apps" like Control Panel are not designed to be built independently from the Windows OS. If you were able to download the source code to Windows and tried to load Control Panel into Visual Studio, it is eminently possible that you could not create some standalone CPANEL.EXE file just via that one project. Rather, you would need to use a customized Windows OS build process to build the whole OS, which would then contain a CPANEL.EXE that would run within that built version of the OS.
Most of the AOSP apps work this way. Some have been forked to create standalone apps -- K-9 Mail came from the early version of the AOSP email app. I have no idea if anyone has done this with the stock AOSP Messaging app or not.
You could instead fork TextSecure[0] as it is no system application but looks very similar to the stock messaging application. The AOSP application needs to be installed on /system/app which requires root and might not be what your customer wants.
Please note that this application is copylefted (GPLv3) so you'd have to give your client access to the source code under the terms of the GPL if you fork.
[0] https://github.com/WhisperSystems/TextSecure

Is there an alternative to using the default android emulator?

Is there a better way to test apk files without actually having to buy an Android phone?
I have to test several apk files and i don't want to use the Eclipse to do this as it would be a lot of downloading just for testing as i don't even want to code.
I am looking for an application which would provide an interface which would ask me which version of Android do i want to run and what screen size do i want and then install the apk for me that i want to test?
Is there such a software available?
thank you in advance.
You don't need Eclipse to run the emulator. You can simply download the android SDK HERE. After you've extracted the SDK, run the file "android" in the tools folder (in linux at least), download which platforms you want to use (1.6, 2.1, etc) and create an emulator. It's fairly simple to do.
Many phone makers offer such a service...
Here's one to start you out:
http://developer.motorola.com/testing/
-I_Artist
This looks like what you are looking for. I never used it myelf though. The reviews seem to be ok as well. not sure if you can choose what api's you want to use though.
http://www.addictivetips.com/windows-tips/download-google-android-emulator/

Categories

Resources