Rename full project Android Studio - android

I have renamed a project following everything that I found by myself and here and it works but only a little.
It seems renamed, but when you check the app info in your device, or you deinstall it, the old name is still there.
How can I do a full rename?
Old name was WifiHome and I want to rename it to Wifi Sentinel.
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "org.grenderg.wifisentinel"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.+'
compile 'com.android.support:gridlayout-v7:22.0.0'
compile 'com.android.support:palette-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
}
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.grenderg.wifisentinel" >
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/icon"
android:label="#string/appName"
android:theme="#style/WifiSentinel">
<activity
android:name="org.grenderg.wifisentinel.activities.BaseActivity"
android:label="#string/appName"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="org.grenderg.wifisentinel.services.WifiScanService"
android:enabled="true"
android:exported="false" >
</service>
</application>
</manifest>
appName = Wifi Sentinel
Renamed everywhere but not here on the info:

Right-click on your root project directory
Select Refactor -> Rename
Select rename project and change the name there.
Also Select rename module and change it there as well. If you get an message saying module name already changed thats fine.
Now right-click on the project root folder again and select Open Module Settings.
Under the Modules section remove whatever folders are associated to your old project name.
Apply Settings and hit OK. and Restart Android Studio.

It seems a bug in devices where te app has been installed before with the old name, I have tried to install on a device where I have never installed the app and the name is shown correctly.

There's a build.gradle file inside your app folder. You have to change the applicationId in there, modify it from AndroidManifest file, as well. Then sync your project with gradle, clean it and rebuild it.

right after advised by other people refactor renaming and gradle file editing :
In Android Studio go to top bar:
File => Settings => Build, Execution, Deployment => Build Tools => Gradle
Now here you have to uncheck "offline work".
Enable network on your comp.
Clean your project (Build => Clean Project)+Run it.
After you see it s all ok with renaming the app_name/label check again "offline work"
(Have made these on android studio 1.2.2)

I had this problem too, no errors but the installed apk had the old name, BUT when testing the game I noticed the old name on the action bar which gave me the clue to the answer,
go to your resources folder, then values folder, then open the strings.xml file. here you should see something like this:
<resources>
<string name="app_name">Rhg Timecard</string>
Change this (in my case it is Rhg Timecard) to your new name.
you should be all set now.

In android Studio go to
res>values>string.xml and change the app there.

Related

App does not overwrite the already existing app

manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.pvijayalakshmi.previousversion">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
grade file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "27.0.1"
defaultConfig {
applicationId "com.example.pvijayalakshmi.previousversion"
minSdkVersion 15
targetSdkVersion 26
versionCode 2
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.+'
testCompile 'junit:junit:4.12'
}
I have developed an application. And I have installed it on my phone.
Now I have a requirement of adding one column to the my application. I have added one column to the database. I have made changes to the onUpgrade(). I have changed the database version from 1 to 2.
I have changed the version code and version name in gradle file.
I don't want to uninstall the app and re installing. I want to upgrade the app automatically.
Now I am trying to install my application(after adding column to database) in phone where previous application is also existed.
I need to upgrade my previously existed application. But I am facing issue here. The present app does not overwrite the previous application. Both applications packages names are same here.
How can I overcome this. I need the programmatic solution.
For example we have many apps like whatsapp. They have made changes to the app and releases. So, we directly update to the new version with out uninstalling our existing whatsapp. Like wise I am trying to do.
Any help would be appreciated.
When I am trying to install application, It is showing like this.
Go to your Developer Options in under mobile setting option
then, Enable these all are
USB Debugging
Install Via USB
Verify apps over USB
these all are should be enable mode(checked mode)
then you have to try..
If your existing i.e installed app in phone is signed APK then to overwrite the new APK on it means without uninstall old one run new APK , you have to install signed APK of new one in sdcard and after that install that. It will work.
you can check sure to uninstall once.
you can clear cache on your phone.after that switch off the phone you can try again install.
if the above not worked can you try creating signed APK file and install that once.
clear the project once again...
Android App Not Install. An existing package by the same name with a conflicting signature is already installed
This answer works for me thank you so much for stackoverflow.
You might want to disable instant run Android Studio Settings or Preferences-> Build,Execution,Deployment -> Instant Run.
clean and rebuild the project again
if you are using miui phone then Turn Off MIUI optimization
Settings --> Additional settings --> Developer options --> Turn Off MIUI optimization

Android build will not merge manifests from libraries

We have multiple projects, depending on a many Android lib modules.
To avoid duplicated xml tags in the apps manifests, we put the relevant receivers, services and activities in their respective modules.
Till today, we used:
Android Studio: 2.2.1
gradle: 2.1.3
buildToolsVersion: 23.0.3
Today we've updated to:
Android Studio: 2.3
gradle: 2.3.0
buildToolsVersion: 25.0.0
Up until this update, everything worked just fine and the manifests were merged, we had conflicts and we fixed them. As of the update we've done, the manifests will not merge, at all!!
--- Update 1 ---
We've used the Merged Manifest view, and saw that it just doesn't include the manifests in the merge, the only thing it does merge from the modules manifest is the permissions, so for example, if I add a new permission to a modules manifest it would ONLY merge it and not the rest of the elements!
I guarantee there are a lot of stuff to merge!
--- Update 2 ---
It seems that everything outside the application tag it merges into the main manifest, and everything within the application tag, it doesn't.
--- Update 3 ---
Module that doesn't merge:
Gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
jniDebuggable true
}
}
}
dependencies {
compile project(path: ':android-infra')
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile project(path: ':engine-core-server')
compile project(path: ':engine-core-aneeda')
}
Manifest:
<manifest package="com.sensiya.voip.managers.gcm"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="com.google.android.c2dm.permission.KAKI"/>
<application
tools:node="replace">
<service
android:enabled="true"
android:name="com.sensiya.voip.managers.gcm.GcmIntentService"/>
<receiver android:name="com.sensiya.voip.managers.gcm.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="com.iamplus.onenumber.device"/>
</intent-filter>
</receiver>
</application>
</manifest>
Module that will merge:
Gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
jniDebuggable true
}
}
}
dependencies {
compile project(path: ':android-infra')
compile 'com.sensiya:sense-services-client:1.24.2#aar'
compile project(path: ':engine-core-server')
compile project(path: ':engine-core-aneeda')
}
Manifest:
<manifest package="com.iamplus.android.senseServices"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
tools:node="replace">
<service
android:name="com.iamplus.senseServices.ContextualEventService"
android:enabled="true"/>
<service
android:name="com.iamplus.senseServices.Serv"
android:enabled="true"/>
<service
android:name="com.iamplus.senseServices.Serv1"
android:enabled="true"/>
</application>
</manifest>
Any suggestions?
It could be many things.Since you didn't provide code, I will guess you are using default merge behavior. For more information, see: Merge conflict heuristics
You can use Merged Manifest view to preview the results of your merged manifest and find conflict errors.
In general, merge by default should work. Then just use Merged Manifest view to see how & where you lost values during merging. Using Merge rule markers would help you to manage merge by assigning rules markers.
If there is no merge at all. so it's probably a dependency issue between modules.
Note that dependency order plays a crucial role with modules which have the same priority level, such as libraries.
--- Update 5.April.2017 ---
Here are some useful tips:
Try to update and rebuild other libs as much as you can.
Remove all dependencies and then clean project, then add them again. and
check if you import them properly. that could be done by build the project without issues.
Note that since gradle 2.2.0 assets from modules won't be accessible
in app.
Check you manifest if merge process is not disabled exciplicitly by attribute:
tools:node=”remove" or tools:node="removeAll" or in gradle( see
this Disable Manifest Merger in Android Gradle Build)
Try to create a demo with a module and track merging. and then match
outputs to your projects. This will make it clear that is not
configuration issue but Android Studio 2.3 ( so then re-install fresh
version )
--- Update(2) 5.April.2017 ---
After you had added code, I could see that you are using Attribute
tools:node="replace"
Under application element in your modules (and probably in app's manifest too). I think that is the reason why you didn't get any manifest merged from imported modules merged to your app's manifest. See tools:node="replace" under Node markers.
Replace the lower-priority element completely. That is, if there is a
matching element in the lower-priority manifest, ignore it and use
this element exactly as it appears in this manifest.
That means both modules above will never get any thing merged with manifest from:
android-infra
com.sensiya:sense-services-client:1.24.2
engine-core-server
engine-core-aneeda
So get rid of that attribute and clean and rebuild modules. then rebuild whole project.
If you are getting manifest merge conflicts you have two options.
1) find all the manifest files included in your project including the ones in libraries that you have as dependencies, and ensure there are no conflicting configurations.
or 2) add some merge resolution rules to your Manifests to dictate how each conflict should be resolved.
There is a great page on that here with many details.
https://developer.android.com/studio/build/manifest-merge.html
From Android Studio
Build ---> Clean project
then
Build --> Make Project
This should help fix
I had a similar problem for Unity. I was able to solve it by going on the SDK Manager and removing the latest android api. Then I installed a slightly older api and it worked (API 21 or 22 I think)
What the SDK Manager looks like
I recently have same problem in my production code.
Having one libraries into app module exists also in other Gradle Dependency causes the duplicate entries.
We need to exclude such module or libraries from conflicted one.
For that we must know number of libraries used by a particular Gadle dependency.
Consider a case where I using "bolts-android-1.2.0.jar" in my app gradle.
In same gradle I m using facebookSDK as below.
compile('com.facebook.android:facebook-android-sdk:4.5.0')
So I have to exclude "bolts-android" as below
compile('com.facebook.android:facebook-android-sdk:4.5.0') {
exclude module: 'bolts-android'
}
So how to know that facebookSDK uses "bolts-android"
Here you can use plugin Android Method Count
Seems like the problem is from using tools:node="replace" in the application element. From the documentation:
...if there is a matching element in the lower-priority manifest, ignore it and use this element exactly as it appears in this manifest.
What you actually want to use is tools:node="merge" which is the default behavior.
Merge all attributes in this tag and all nested elements when there are no conflicts using the merge conflict heuristics. This is the default behavior for elements.

Application crashes by installing APK while running from Android Studio works perfectly

I recently updated Android Studio to 2.3 and SDK to 25. Now when I run application from Android Studio on my mobile or emulator it is working perfectly but when I generate APK or get APK from App and install on device it crashes.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "lovestar.lycamobile"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="lovestar.lycamobile">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/lycalogo"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name="lovestar.lycamobile.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="lovestar.lycamobile.Lyca"></activity>
</application>
I faced this problem 2-3 days ago. It happens because of Instant Run Feature. Most recent code of App is not properly build on APK So rebuild APK from Android Studio Menu
To solve this:
Use Build APK option from Android Studio Menu and install in Mobile.
If Above Step does nothing See Step 2
Usually it's AndroidManifest.xml problem that does not have proper
package name or activity with MAIN intent was not properly defined.
That's easy fix.
Possible/Common causes of “Application not Installed” error
Insufficient storage space: Your storage space may have filled up
with no more space to accommodate new apps.
Corrupted app or apk file: This is most common with apps downloaded from outside Google Play Store. The app is either corrupted or incompletely downloaded or copied as the case maybe.
Incorrect app install location: Some apps are meant to be only installed on phone memory while some others can be installed on both phone memory and SD card. Trying do otherwise with the former can bring up this errors.
Installation on a mounted SD card: Maybe, your SD card is mounted on a laptop or elsewhere. Trying to install anything in this state will result in errors because the SD card is inaccessible.
Corrupted storage (Phone and SD card): This is probably the most common cause of this error. If the storage of your device is corrupted, any app installation will be impossible.
Apk signature/certificate clash: Installing another version of an app (with a different signed certificate) on the same device will probably result in this error. Installing an unsigned app could also result in this error.
App permission errors or temporary OS glitches could also bring about this error.
I think you have not exported the APK in right way that's why you are getting this error.
Generate Signed APk and you will get rid of this problem.
SDK Level 23 means Android 6.0 Marshmallow. Is your mobile's android version really equal to or grater than 6.0? To check this, open Setting app, scroll down, tap Informations, then software info. You'll se your Adnroid version at the top.

Android - Error on installing apk - parsing the package

I have a very similar issue, to this one:
Error on installing apk - parsing the package
but the answers there didn't help me.
Shortly, I have an application that I develop, and in each big change that i make, I check it in my phone also. And it never had problems until now.
I didn't do it for a week, and I changed things in the code, that I don't realy remember (problems with Git, another issue...).
The app is using Firebase, so I had to update SDK on Android studio to 2.2.3.
Maybe this is the problem? And if so, what is the solution? I can't think on another reason.
On emulator it works great. Only on device it's not working.
Until now, i just entered into APK folder in the project, and sent "app-debug.apk" to my mail, and I opened it in my phone mailbox.
Now this file leads to "There is a problem parsing the package.".
So I tried to get the APK in different ways:
1. build-> build APK.
2. build-> generate signed APK, as mentioned in the answer in the link.
3. take the release APK.
4. take the debug APK.
Nothing works!
I tried it on 2 devices:
Meizu M2, Android 5.1
LG 3 beat.
build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="some package....">
<!--
android:label="#string/app_name"
-->
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="Mission List"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
some info...
</activity>
<activity android:name=".newList">
some info...
</activity>
<activity android:name=".viewGroups">
some info...
</activity>
<activity android:name=".tasks">
some info...
</activity>
</application>
Please help!
This will happens when your are installing the app with applicationID which is already available on device.Two app with same appId.

Android Studio is full of errors

Okay, so I can't develop nothing as my Android Studio decided to.
My all project is full of errors, unknown errors caused by Android Studio.
note: my files are correct, it is an other problem because even if I will import something from google codes it will have errors.
When I import a project everything's fine, but then after indexing and such things, all sudden everything is red and shouldn't be.
My errors for example are :
button1.setOnLongClickListener(new View.OnLongClickListener()
{
....
....
}
Well shouldn't be error but : cannot resolve symbol setOnLongClickListener
Another example:
button1=(Button) findViewById(R.id.button1);
I used this exact code for other button, seems right, I always using this line, it was fine until my Android Studio decided to give me some hard time, this line is full by errors and they are:
Unknown class: 'button1' , invalid method declaration; return type required, missing method body, or declare abstract
and there are like 20 errors that shouldn't be, things I tried:
deleting iml files , .idea folder - worked for a while but now it happened again and it doesn't fix it.
reinstalling android studio and then importing project.
upgrading android studio version to 1.3
restarting my pc.
importing project to an other pc, happened after a while.
Invalidate caches/ restart.
Changing module in project structure - I changed it back to how it was (it didn't help) and I think it caused the manifest error down..
My Module:app build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "firstappdevelopments.david.reactiontime"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
}
Also I noticed now, my Manifest file as an error in android:name=".MainActivity" says it has no default structure. something like this. here is the full normal code:
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
</manifest>
Please, if someone knows what is the problem or what can I else do, just say, and I am sorry about my English, thank you all.
What I've seen is my code is full of errors, but it still builds fine and deploys fine to the device.
To fix it:
click on FILE > INVALIDATE CACHES / RESTART
Then close the project
Re open the project
For me I upgraded my Kotlin Version from 1.4 to 1.5.0 and it is now working.
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Afterwards I did a clean and a Rebuild and everything worked fine thereafter.

Categories

Resources