[Q] Running Signed APKs from Android Studio - Android Studio

Background:
I have two build types: release and debug.
I have two flavors: full and demo.
Problem:
I am using Build->Generate Signed APK… to compile and build a release version of Demo/Release. That goes fine. However, I can't figure out how to run the resulting APK from within Android Studio. More specifically, using the "Run" command (with the Build Variant value set to the desired variant) causes the following error:
app-demo-release-unsigned.apk is not signed. Please configure the signing information for the selected flavor using the Project Structure dialog.​I get this error despite the fact that there *is* an app-demo-release.apk also (i.e., a signed version). In fact, I get that same error whether or not either APK (app-demo-release.apk, app-demo-release-unsigned.apk) exists. (Note: I specifically do not add signing information to the Project Structure dialog, as suggested, because I don't want to have my passwords stored in build.gradle or in environment variables.)
How can I run a release app, as generated with Build->Generate Signed APK…, from within Android Studio? Alternatively, how can I specify where to find the APK I would like to have deployed (e.g., as part of the Run/Debug Configuration)? (Note that setting the Build Variant value doesn't fully specify the APK.)
Thanks,
Barry

Related

Android Studio - Stuck on “Build Gradle” when creating a new project

favorite
I have tried different solutions but none of them seem to work for me. I have installed the latest AS on my Windows 7. Everything downloaded fine(I'm not behind any proxy) However, when I try to create a new Project, after I set the name,Activity name(which I live as default) and finish the settings, a message pops up saying "Gradle Build"; It keeps building but I don't know what it's doing.
I've tried the following steps to fix it: -Deleted .gradle so that it creates a fresh one as the original might be corrupted -Downloaded gradle manually and pointed AS to this -Downloaded gradle zip manually and put it in .gradle>wrapper>dists>2.14.1>numbers>zip file here
Any idea how to fix this?
Thanks

Oreo SSAID/Device ID issues

Hi all
I play a game on several Android devices that incorporates the Device ID in the save files. The game devs will port save files for you when you change devices but this takes several days, so normally I root and use Device ID Changer app to keep all my devices on the same id.
Now that I'm using Oreo, I understand that it handles the Device ID in a very different way so that each app instance has a unique id associated with it. Is there any way to find out what this id is for a particular app and then to change it. I have root, and terminal and am not bad on the command line, if a little rusty.
Sláinte
mmidders
==
Xiaomi MIX running Resurrection Remix OS 6 (Oreo 8.1)
I found the solution to the problem in the following post:
https://forum.xda-developers.com/android/general/tool-device-id-changer-oreo-t3768277
Oreo stores deviceids in /data/system/users/0/settings_ssaid.xml so you can either use the tool from the above post to change them, or I presume that you can use a root text editor to modify the file directly. Changes won't come into effect until after a reboot.
I found the solution to the problem in the following post:
https://forum.xda-developers.com/android/general/tool-device-id-changer-oreo-t3768277
Oreo stores deviceids in /data/system/users/0/settings_ssaid.xml so you can either use the tool from the above post to change them, or I presume that you can use a root text editor to modify the file directly. Changes won't come into effect until after a reboot.

Cannot build after upgrading from 1.0 to 3.3

I have upgraded from Android Studio 1.0 to 3.3.
I was building and rebuilding and flashing my software to phone very effectively on 1.0 and now after upgrade after nearly two days of work I can still not get the basics (build Android app as far as java compile errors) working.
I appologise if my questions are not perfectly formed, I am beginning to get really tired and confused and I would be so grateful of a little latitude and some help to get back to where I was.
When I installed 3.3 it recommended that it uninstall the current version, which I agreed to it doing. So fresh start I guess.
Amongst other things...
After the install, my app would not build and kept asking for a newer version of gradle. I set in settings local gradle 4.10.1 and I set the gradle plug-in to 3.3.0 in the top level gradle file. I tried setting "use default gradle wrapper" and then setting these versions in "project structure" but they kept changing back again, so I used the other method just described. It then complained it couldn't find that plugin so I added repositories google and jcentre to that file. It then began to build but complained that a version of build tools could not be installed because the license had not been accepted. I clicked on the link provided and accepted the license, but the build tools would not install, no reason.
I could not find "sdk manager" menu item anywhere in AS menu structure. Don't know why. It used to be there in 1.0.
Thinking it's a brand new install as it said I go to OS start->all programs->Android sdk tools and launch sdk manager as administrator. I install the offending build tools version accepting the license.
I rebuild, same error.
I look where that sdk manager exe was and there is no license folder in that folder nor the one above.
I root around the folder structure and find a different sdk manager under prog files (x86)\Android\android-studio\sdk and a license folder in the folder above. I run that sdk manager and install the offending build tools version accepting the license.
I go back to Android studio and click rebuild project, nothing I mean literally nothing happens, clean, nothing, make, nothing! Nothing at all! I close AS and restart it (as administrator), exact same issue. This new issue really gives me very little to work with as there is no feed back at all. I'm beginning to regret upgrading AS as it is holding me back from coding now.
I have two questions:
1) Can anyone see a possible way out of my immediate problem and how to get my project at least attempting to build again and get at least as far as just compile errors.
2) Am I right in thinking that current version of AS is far from an out of the box experience even for the common default activities (build Android java project) and has a variety of unexpected anomolies OR a lot of settings whose defaults may very likely not be useful and need manually resetting? IF SO... Is it therefore recommended I do a couple of days reading maybe about the structure of "specifically" AS and it's dependant components and how to set them up and use them effectively? IF SO... what documents would one recommend, so as to make the most efficient use of time.
Apologies if this is not well formed. Hoping for some help.
Thanks.
@hardya
I have AS installed on linux so I can't help you much with windows. I can tell you that AS 3.3 works great and is much better than 1.0. Mind you, I've been using AS since it was in beta.
Try to create a new project. If the new project is created and builds without error, then you know AS is working correctly.
If the above doesn't work then I recommend you do a full uninstall of AS and then do a fresh install as follows.
Follow this AS uninstall guide:
https://stackoverflow.com/a/39953746
Then follow this guide to install AS:
https://developer.android.com/studio/install
Then try a new project as mentioned above. If the new project goes well, then you can proceed to import the project you was working on originally.
Thank you. I think there are possibly issues with this upgrade path. It was supposed to have uninstalled completely (said it was doing so) and installed 3.3 afresh. However when you open "AS" itself it opens with the existing project in place. It is not until you close that project that it suddenly closes AS, reopens AS and enters the first startup wizard to complete the remainder of the installation / configuration.
I think I am a step further on since then.
Thanks

Investigating Huawei system app - your help needed

Hi guys,
I was recently reverse engineering a package com.huawei.autoinstallapkfrommcc and trying to understand what it is doing.
From what I could see it looks like this service after system boots up, is checking what mobile carrier you are using and then loads a list of packages from file autoInstallAPK.xml and then installs/uninstalls them based on mcc and mnc codes.
I am wondering if this xml file can be used to bypass device security. However I can't find it on my device.
Could you please check if you have a file at
Code:
[ROOT]/System/etc/xml/autoInstallAPK.xml
and share it if it exists there?
Check your
/cust/vendor/country/xml/*.xml
&
/preload/model/vendor/country/xml/*.txt
Look also for :
APKInstallListEMUI5Release.txt
&
DelAPKInstallListEMUI5Release.txt
Share back your tweaks and findings
oslo83 said:
Check your
/cust/vendor/country/xml/*.xml
&
/preload/model/vendor/country/xml/*.txt
Look also for :
APKInstallListEMUI5Release.txt
&
DelAPKInstallListEMUI5Release.txt
Share back your tweaks and findings
Click to expand...
Click to collapse
I don't have such folders, did you mean main partition? I don't have root so I am quite limited.
Maybe this config file is included only in roms which come from mobile carriers like Verizon, T-Mobile etc.
So far what I think this package is reading from that xml is:
* package name
* apk path
* action type (install, uninstall, disable, maybe others)
* card info (probably sim card info/ carrier info)
Then this data is being processed (atm I don't fully understand the process flow but in general it goes through each element (app) described in the xml list and takes defined action depending on the carrier you have). Ofc whole process is not started untill system is booted and sim card present/installed.
I wonder why Huawei have implemented such service. Maybe to make it easier for carriers to install branding apps on EMUI? Maybe this is only used to install carrier config package to. Can't really tell at the moment.
However I see a potential use case where someone uses buffer overflow or other vunerability to alter/overwrite this xml file. This could allow someone to install malicious apps on the device.
I am now analyzing bytecode of the part that is parsing InputStream from xml to see if I have missed something.

I created a temporary app and now need to edit it but can't get back to the same layout as I was in when I built it.

I successfully completed an app from a tutorial I was following, built in Android Studio. I ran it on my phone and it works as it was designed. I now need to alter the design to meet my needs but I can't get back to the layout it was when I entered the code in to the various modules. How do I do that?

Categories

Resources