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.
Related
I have installed the fabric, integrated jar files and API key.
I installed fabric plugin, sign in, crashlytics, answers, and crash.
In gradle, I add 2 meta data in AndroidManifest.
<meta-data
android:name="io.fabric.ApiKey"
android:value="***" />
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />
I add maven and... in project gradle.
maven {
url 'https://maven.fabric.io/public'
}
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.firebase:firebase-plugins:1.2.0'
classpath 'io.fabric.tools:gradle:1.28.1'
I did all the necessary work, but fabric dashboard is not showing.
None of 3 steps have been taken, but I do it all.
Kevin from Fabric/Firebase here - are you integrating with Fabric or Firebase Crashlytics instructions (https://fabric.io/kits/android/crashlytics/install vs https://firebase.google.com/docs/crashlytics/get-started?platform=android)?
If you reach out to support#fabric.io with your app's package name and a link to this post, we can take a closer look at what's going wrong with the onboarding process for your app.
I have integrated AppsFlyer SDK for analytics, it is tracking app installs but somehow when using uninstalls feature it crashes.
I have initialized SDK in MyApplication
AppsFlyerLib.getInstance().startTracking(this, Constants.APPS_FLYER_KEY);
I dont have GCM/FCM in my application so i have followed Android Uninstall Tracking
So i have written this code in my manifest
<service android:name="com.appsflyer.FirebaseInstanceIdListener">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
But it is not able to find FirebaseInstanceIdListener class
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.appsflyer.FirebaseInstanceIdListener"
Check the Android SDK installation steps. I followed this so I was not able to reproduce it.
So, I thought about possible cause, I tried to reproduce this error by simply not adding mavenCentral() in repositories object. And I faced the same error as you got.
Just to make sure if you have added below lines in your app.gradle before dependencies object:
repositories {
mavenCentral()
}
Adding to #Chintan-Soni's answer:
Our native Android SDK is distributed via MavenCentral repository, which replicates with the JCenter repository.
However, as we don't have control over this process, we instruct developers to add the MavenCentral repository to their project-level Gradle configuration file (build.gradle):
buildscript {
repositories {
mavenCentral()
}
}
And of course, Add the compile dependency with the latest version of the AppsFlyer SDK in the app-level build.gradle file:
dependencies {
compile 'com.appsflyer:af-android-sdk:4+#aar'
}
A local JAR file is another option to get the SDK.
You can find all the information required for integrating AppsFlyer SDK -
here.
Please submit any issues to support#appsflyer.com, so our support team could provide you with a quick and professional response.
When submitting an issue please specify your AppsFlyer sign-up (account) email , your app ID , reproducing steps, logs, code snippets and any additional information that could help.
I have issue with build variants and FCM.
I have defined 3 variants: dev,qa,release
dev/qa have applicationIdSuffix '.dev'
release has no suffix
google-services.json file has both package names properly defined and I read that google-services plugin reads it automatically during build process.
When I launch the dev variant, everything works just fine. But after that if I switch to release variant and try to launch that the app just hangs giving following trace:
ANR in xxx
Reason: Broadcast of Intent { act=com.google.firebase.INSTANCE_ID_EVENT flg=0x14 cmp=xxx/com.google.firebase.iid.FirebaseInstanceIdInternalReceiver (has extras) }
Dev variant works always, but staging variant also hangs in the start.
Possible related issues:
Application not responding after adding Firebase
NOTE: I also tested debug variant with exact same config staging variant has and it worked. So Gradle do something different with debug variant because there are no problems with that.
Any ideas how to fix this? Is this because of Android Studio or maybe some wrong configuration in gradle? Colleague has never seen this issue when he builds the app.
I also tried to remove android studio and reinstall it, also removed the project and pulled the source again, but the error still happens with my laptop.
Thanks.
NOTE: I rebooted my laptop, and run clean assemble from the terminal, all of the variants now seem to work. I noticed that sometimes when building directly from Android studio it seems that the application kinda starts in parts and then it gets removed which then causes the FCM receiver to hang up because the app just got removed. Is this some configuration of Android studio?
CONCLUSION
Didn't find the actual reason of my Android Studio / Laptop / Gradle setup which caused this, but if you encounter the same issue. Try rebooting your computer, re-cloning app project might help, also building variant from command line with clean option can also help instead of building it with Android studio.
Make sure you have Implement both this services in your manifest file.
<service android:name="com.test.notification.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="com.test.notification.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
Try to put
apply plugin: com.google.gms.google-services
to the end of the build.gradle
and
compile com.google.firebase:firebase-messaging:x.x.x
top of dependencies
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.firebase:firebase-messaging:x.x.x'
}
apply plugin: 'com.google.gms.google-services'
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.
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.