Creating a debug app - android

Okay so i have an application, put up on the playstore.
What i want now, it to create the same application but with debug postfix in the name and it must have everything same.
I want to do this, because i do not want to disturb my original project when i am experimenting stuff,
So what i did was, i copied the project folder from wherever it was to the desktop, original one had the package name com.femindharamshi.spa so i refactored the whole thing to com.femindharamshidebug.spadebug and all changed the app_name in string
but when i try to open this app in the emulator, Android Studio Gives me the following error :
Installation failed with message Failed to finalize session :
INSTALL_FAILED_INVALID_APK: Split_lib_slice_4_apk was defined multiple
times. It is possible that this issue is resolved by uninstalling an
existing version of the apk, if it is present, and then re-installing
Also i do not want to uninstall the original app from the emulator/physical device, i just want to add this app for testing purposes. What should i do ?

Try closing the Android Studio and giving clean and build to the project.

change you application ID in app level build.gradle file and sync the project
applicationId "//pkg id here"

Related

Fabric Crashlytics stuck on build and run

Currently, I'm trying to integrate Crashlytics into an Android Application. However I can't get the app to be recognized and added to the Fabric Dashboard.
When using the Android Studio Fabric plugin following these steps:
New App
Select Crashlytics
Apply Code changes
Sync gradle
Rebuild project
Build app onto device (not virtual)
However when I do this, the Fabric plugin is still stuck on the "Please build and run your application" screen, and eventually gives an error message "It's been a while. Need some help?"
I've also attempted to install Crashlytics manually, by adding the code myself using this link: https://fabric.io/kits/android/crashlytics/install
But when I build the application, still nothing happens within my Fabric Dashboard.
I've attempted checking out the branch again and re-adding this code to no avail. I've also tried reinstalling the Fabric IDE plugin, restarting Android Studio and Restarting my machine.
I have successfully added Crashlytics to other applications following these same steps.
Any ideas?
I just had the same problem - nothing happened in the Fabric-plugin screen saying "Please build and run your application" during app-launches.
It started working after I disabled Instant Run (Preferences > Build Execution Deployment > Instant Run) then rebuilt and run the app.
Probably you forgot to add apply plugin: 'io.fabric' in start of your app level gradle.build file
I have had a similar problem - month ago I refactored package name and inserted wrong char to name (cyrillic с instead of latin c), what I only have seen now by viewing java code in hex-editor. In the build.gradle applicationId = "package name" was write similar as package name in *.java files, but only all chars were the right in latin.
Simple refactoring app package name to right name that equals the appliationId and clean/build project not solve that problem with the Fabric Crashlytics. May be wrong package name stay in another files, not only in *.java, manifest and gradle. I don`t know. Because I made fully refactoring by next step:
1) delete all lines of code that was added by Fabric plugin (if you used automatic code inserting) or that was added by you manually from build.gradle (app), AndroidManifest.xml, MainActivity.java.
2) replace old package name to new by Edit>Find>Replace in Path
3) manually copy all minimal needed project files to new project folder. I copyed these folder and files
NewProjectFolder/build.gradle
NewProjectFolder/app/build.gradle
NewProjectFolder/app/src/*
NewProjectFolder/app/libs/*
4) close current project, at "Welcome to Android Studio" select Import Project and select project in new project folder.
5) make some refactoring to run your app normally (I use Firebase, therefore I add this new app to my Firebase project in Firebase console and download the new google-services.json to NewProjectFolder/app/ )
6) be sure your app runs as well as before refactoring and stop it
7) start Fabric plugin, press "+New App" > "Crashlytycs" > "Install" > "Apply" to make auto-install fabric`s code to your build.gradle (app), AndroidManifest.xml, MainActivity.java.
8) run your app and wait "Done!" on Fabric plugin. After this you can see your app in Crashlytics dashboard.
It has worked for my project and I hope help to you.
I also had this problem. Make sure you rename your application package identically to what the application ID is.
For instance, I had the package structure com/exampleapp/, but it should have been com/companydomain/appname, because the application id was com.companydomain.appname
Have same issue here, i resolve doing these things:
First, add at your app build.graddle file:
defaultConfig {
applicationId "<your package name>"
}
If that doesnt resolve, try change your applicationId to other one, that doesnt match with your package.
For some reason, they worked here.
Also had this issue, then
I refactored my application package name
and
changed application id name in gradle
built it again and the issue was solved.
Make sure to include all dependencies on their dedicated gradle.build and meta in manifest file. Next is to throw a force runtime error on your device with internet connection also do not forget to initialize it first with Fabric.with(this,new Crashlytics()). If this doesn't work try to download Fabric for Android plugin in Android Studio and select your package.
This helped me:
https://developer.android.com/studio/build/optimize-your-build#disable-crashlytics-build-id
If you want to use Crashlytics with your debug builds, you can still
speed up incremental builds by preventing Crashlytics from updating
app resources with its own unique build ID during every build. Because
this build ID is stored in a resource file that is referenced by the
manifest, disabling automatic build ID generation also allows you to
use Apply Changes alongside Crashlytics for your debug builds.
To prevent Crashlytics from automatically updating its build ID, add the following to your build.gradle file:
android {
...
buildTypes {
debug {
ext.alwaysUpdateBuildId = false
}
}

Visual Studio 2017 - Xamarin - The file "obj\Debug\android\bin\packaged_resources" does not exist

I'm fighting with that issue for 2 days already and can't find any solution.
I have an Xamarin Android app in Visual Studio 2017 consisting of three projects:
Xamarin.Android project (main one)
Android-specific unit tests run on the device - project of type NUnit 3 Test Project (Android) created using NUnit Templates for Visual Studio
Platform-independent unit tests project (project of type Unit Test Project (.NET Framework))
Everything worked just fine until now. When I selected my main project as the Startup one, my app was deployed to the device/emulator. When I selected my Android-specific unit tests project, the test project was deployed and unit tests executed by nUnit Xamarin Runners on the device/emulator.
However few days ago I updated my Visual Studio 2017 with the newest available update and now, when trying to build this android-specific unit tests project I get the following error:
The file "obj\Debug\android\bin\packaged_resources" does not exist.
I've searched everywhere, including this and this SO topics. I also totally reinstalled Visual Studio 2017 and Xamarin with Android SDK included. Nothing helped. From what I read I suspect there is something wrong with the versions of Android SDK Build-tools I have installed. Here's what I have currently installed in SDK Manager:
As the other SO threads suggested, I tried uninstalling the newest Android SDK Build-tools (25.0.2) and installed version 23.0.3 (all my projects target Android 6.0), but it also doesn't help, I still have the same error.
Maybe it's worth adding that this issue may have started to happen when I tried to implement RecyclerView in my app reading this tutorial, where they suggested to install Android 7.1.1 (API 25) in SDK Manager. However I undoed my all changes after that and even reintalled VS2017 + Xamarin.
Do you have any other idea why this can be ? I'd really appreciate any help. Thanks!
EDIT 2017-04-09:
Egh, I removed VS2017, installed VS2015 with brand new Android SDK and still the same issue :(
I've finally found what was the issue. It wasn't related to any component from SDK Manager or VS version.
Following localization tutorial from developer.xamarin.com, I played a bit with Strings.xml in my Android project. I wanted to have my Activities Label taken from resources as well, so in the ActivityAttribute I defined:
[Activity(Label = "#string/peopleListTitle")]
and added this value in Strings.xml file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-------Other resources values ----->
<string name="peopleListTitle">People List</string>
</resources>
In that case my build is failing with above-mentioned error:
The file "obj\Debug\android\bin\packaged_resources" does not exist
When I change ActivityAttribute to use a string directly:
[Activity(Label = "People List")]
the build is passing without any issues.
I managed to find a solution, but actually I don't know why it's not building when I try to use Label text defined in Strings.xml.
BTW, I managed to find what's the problem by setting build output verbosity to Diagnostic in Tools -> Options -> Projects and Solutions -> Build and Run which gives a detailed info why the build failed in the Output window.
I had the same problem. After removing the dash "-" sign from the image file name, the problem is solved. Bad error message! It should not be:
The file "obj\Debug\android\bin\packaged_resources" does not exist.
Writing an error message like this causing the Developer to think about something else while the problem is the illegal file name.
I had the same issue when I added a new image as a resource.
There was a '-' in the file name (Invalid resource name character). I renamed & removed that character and all good.
Resource name can only consist of 0-9,a-z or A-Z or combination of any.
I had the same problem, and i removed all image file name have "-" character. My problem solved
Another reason for this error is that you may have a float number as your version number. In my case I changed it to a integer and everything worked fine. (I found the error by switching the build output to Detailed)
Simply it worked.
In one case I copied and pasted previous working "packaged_resources"
in the bin folder.[the problem was it did not reflect the UI changes]
Other I opened the visual studio as
administrator.
Next changed the "Minimum target to Android" to lower
apis in the project properties windows.
I suggest not touching the code behind of the design. If you get this error simply pull some button from the tool bar into the design and visual studio will come to its consciousness that there is change in UI. Next click on save all so that it make necessary change in the designer file.
Mine was a different solution (and only half a day lost): I was having trouble getting Hockey app to match crashes against the correct version of the app and realised it uses VersionCode not VersionName so I change my code to "0.0.34" the same as the name. For some still unknown reason the app built and deployed to devices for about 3 days before I started getting this error The file "obj\Debug\android\bin\packaged_resources" does not exist. Setting it back to a numeric value fixed the problem.
I found the problem by looking back through my GIT logs and rebuild each push until I found the one that caused the problem.
It just because the Version Code,I set Code by '1.0',The file "obj\Debug\android\bin\packaged_resources" does not exist.;And I set it by '1',everything is ok.
Had the same error, the way I got over it was crank up the Android SDK manager and install all updates and remove any obsolete packages. This happened to me because I was targeting something newer which was not installed.
Check to see if there are any unused entries in resources.designer.cs if there are any manually remove those entries.
This will fix the issue.
After following several online suggestions - updating SDK, updating Xamarin etc - none of which worked for me.
Finally found that I had an activity for a Android provider to Alarm clock in my AndroidManifest file as below
<activity
android:name="com.njcommuter.droid/android.provider.AlarmClock"
android:label="AlarmClock"
.....
/>
Removing this line - and rebuilding worked fine without any errors and was able to deploy solution successfully.
Note : testing this by putting the line back, and I get same error again on rebuilding.
It can be linked to using any android provider which creates the package for it, not necessarily AlarmClock only.
This error is, somewhat of, a wrapper for what can be multiple reasons that that the file was not created. The key is to look in the detailed output and look for the underlying error causing the file creation failure.
In my case, I had corrupted icon.png files (generated right from from the VS xamarin nunit template, no less!). Once I put in valid png files, everything was built fine.
Another reason for this error, if that the android NDK (not android SDK) isn't right, change de version can resolve the problem: go to Tools/Options/Xamarin/android Configurator and change de folder, in my case I've three, the last one can't compile, but the second folder with version xx.r11c do it.
For me it was Target Android Version.I had it set to
but changing it to Compiling version(for me it was the latest platform) resolved the issue.

Attribute "imageAspectRatioAdjust" already defined with incompatible format.(APT0000)

My game is able to build and run on debug mode so I was hoping it would be ready to be built in release mode but I'm currently stuck with this error in the title. Anyone knows the solution?
EDIT : I've tried commenting the imageAspectRatioAdjust in common_attrs.xml but it would cause alot more different errors.
EDIT : I've found out that there is two file that contains imageAspectRatioAdjust in the release folder of my game when I tried to build it, but there is only 1 file that contains imageAspectRationAdjust in debug. Even if I tried to delete one or the other, I have to clean and rebuild and it would reappear again in the same folders.
I've added Facebook Android SDK into a sub project which a main project is dependant on, which requires me to add Facebook Android SDK into the main project as well but I've accidentally updated some of the packages in the component on the main project and did not update the packages on the sub project, which seems to be the cause of this error.

how to installed apk without uninstalling the current apk of the same App

I used to work with Android studio 1.4. yesterday I downloaded the newest version of android Studio 2.1.2 and it did not work well for me, so i reverted to Android studio 1.4.
the problem is, when i tried to run my App, I received a message telling me, "that the apk is already installed on the phone and to reinstall it i have to uninstall the version that is already on the phone".
Actually, I can not uninstall the apk version that is currently on the phone because it contains a huge database, and if i uninstalled it, then the databse content will be lost and i have to do it from the beginning
is there any other solution to run the App "apk" without uninstalling it
i am getting this message:
The easiest and the fastest way is to change application package name.
An appropriate way to do what you want would be to use ProductFlavours.
You start by adding the following to your app's build.gradle:
android {
productFlavors {
dev {
applicationId "com.yourapp.dev" //one in development mode
}
prod {
applicationId "com.yourapp" //the package name for your released app
}
}
}
You can add parameters different for the dev and production apk(s) as BuildConfig fields.
Do study more about it, will be able to implement it in the way you want. You can start with
Mastering product flavours on android
Just change the applicaitonId property in the app module's build.gradle.
Change version code and version name in build.gradle.
Hope this will help you.
1-First of All Please Change Your Current Application Package name
2-Build The Application
3-We can't use same package name in android
4-Work Will File after completion this steps.
Just change the applicaiton's Id property which is located in the app module's build.gradle.

Install few APK files on phone - different versions of the same app.

I decided to have few versions of the same app on the phone.
I clicked 'run' on first version of app in eclipse and apk was installed with the name: 'p2'. Then I changed package statement in Manifest to 'p5' , and changed all links in application classes and xmls, rebuilded app and clicked 'run' again to install next apk on the same phone.
To my astonishment I have two applications with name 'p2'.
I expected to see 'p2' and 'p5'.
I was looking for an occurence of 'p2' in my code but there was no such place.
Can you guide me to solve this?
To install the same application on the same device do followed steps:
change Application package (where your main Activity is located)
change Application Name (optional, doesn't seem good two equal names on the same device)
If you compile applications from Eclipse, you must change also .project file:
<projectDescription>
<name>Appl</name>
otherwise you can't import second application with the same name

Categories

Resources