Unresolved package "generated" in AndroidManifest.xml - android

In my Android Studio androidManifest.xml file, I found an unresolved package generated. How can I fix it?
The issued code is : android:name=".provider.generated.SquawkProvider
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.aaa">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
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>
<provider
android:name=".provider.generated.SquawkProvider"
<!-- shows unresolved package "generated" -->
android:authorities="com.example.android.aaa.provider.provider"
android:exported="false" >
</provider>
<activity
android:name=".following.FollowingPreferenceActivity"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
<service
android:name=".fcm.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
</application>
</manifest>

This issue stems from annotation processing now being included in Gradle from version 2.2. You can fix project and get it running with the following changes.
Project level "build.gradle" remove this line:
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2'
App level "build.gradle" remove this line:
apply plugin: 'android-apt'
and change this line replacing apt with annotationProcessor:
apt 'net.simonvt.schematic:schematic-compiler:0.6.3'

In build.gradle(Module:app)
remove this two line
1) Top on the file
apply plugin: 'android-apt'
2) in dependencies
apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
add this
annotationProcessor 'net.simonvt.schematic:schematic-compiler:0.6.3'

If the above responses don't work for you, make sure you are using the latest version of Android Studio and gradle plugin (4.4 as of this post) and have changed all the 'compile' lines with 'implementation'.
After that try Build -> Clean Project then Build -> Rebuild Project. (All of this after following #drspaceboo's answer of deleting classpath and plugin lines, then changing apt to annotationProcessor.)

Try this:-
Go to File -> Invalidate Caches / Restart and then Invalidate and Restart.

Related

Problem with flutter plugin (Image Cropper)

I'm creating a app which will work with images, some of them will need to be cropped and some not. I have added the library:
image_cropper: ^1.3.1
I have installed the dependencies in android manifest:
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
// This is wat I had to add as said in the pub.dev from icon cropper
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"/>
</application>
</manifest>
But when I run my application I receive the following error:
Launching lib\main.dart on SM N950F in debug mode...
lib\main.dart:1
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not resolve com.github.yalantis:ucrop:2.2.7.
Required by:
project :app > project :image_cropper
> Could not resolve com.github.yalantis:ucrop:2.2.7.
> Could not get resource 'https://www.jitpack.io/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom'.
> Could not GET 'https://www.jitpack.io/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom'.
> Connect to www.jitpack.io:443 [www.jitpack.io/149.56.28.39] failed: Read timed out
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 36s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
This is my settings.gradle:
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
I have multiDex enabled too.
I have image_cropper working, an example for you to check and compare if is everything ok.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label=""
android:usesCleartextTraffic="true"
android:icon="#mipmap/ic_launcher">
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"/>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
Check if you have a good internet connection and then build the project again

All Activities and layouts got corrupted in Android Studio

I am working on a projects since 3 months. Today most of my activities and xml files got corrupted. I have tried deleting workspace.iml file but it remains same.Local History in VCS is also empty. Is there any way to recover my code or solve this issue.
Note These files are same as previous if I open then in Notepad app/scrc/main/activity.java, but showing different in Android studio
Here what my code looks like now
<component name="libraryTable"> <library name="Gradle: com.google.firebase:firebase-measurement-connector-impl-17.0.3">
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/firebase-measurement-connector-impl-17.0.3.aar/fb2536827bf92d82ab72080a9863eb78/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/firebase-measurement-connector-impl-17.0.3.aar/fb2536827bf92d82ab72080a9863eb78/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
gradle file:
apply plugin: 'com.android.application'apply plugin: 'com.google.gms.google-services'android {
compileSdkVersion 28
defaultConfig {
applicationId "com.apkfeast.class11walkthrogh"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }}dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.firebaseui:firebase-ui-database:4.2.1'
implementation 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.github.bumptech.glide:annotations:4.8.0'
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
implementation 'com.android.support:multidex:1.0.3'}apply plugin: 'com.google.gms.google-services'
Manifest
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.apkfeast.class11walkthrogh"
android:screenOrientation="portrait" >
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<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"
android:fullBackupContent="true">
<activity android:name=".Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713"/>
<activity android:name=".Hyderabad" />
<activity android:name=".Mirpurkhas" />
<activity android:name=".SelectBoard" />
<activity android:name=".Quiz" />
<activity android:name=".Notes" />
<activity android:name=".fedral" />
<activity android:name=".sukkur" />
<activity android:name=".larkana" />
<activity android:name=".aghakhan" />
<activity android:name=".sarghoda" />
<activity android:name=".Rawalpindi" />
<activity android:name=".Faisalabad" />
<activity android:name=".Multan" />
<activity android:name=".Gujranwala" />
<activity android:name=".lahore" />
<activity android:name=".karachi" />
<activity android:name=".sahiwal" />
<activity android:name=".dgkhan" />
<activity android:name=".peshawar" />
<activity android:name=".bahawalpur" />
<activity android:name=".balochistan" />
<activity android:name=".hydchem" />
<activity android:name=".hydphy" />
<activity android:name=".hydbio" />
<activity android:name=".hydeng" />
<activity android:name=".hydisl" />
<activity android:name=".hydurd" />
<activity android:name=".hydmat" />
<activity android:name=".hydpak" />
<activity android:name=".hydviewdown" />
<activity android:name=".mpkVD" />
<activity android:name=".fedVD" />
<activity android:name=".sukVD" />
<activity android:name=".larVD" />
<activity android:name=".sarVD" />
<activity android:name=".rawVD" />
<activity android:name=".faiVD" />
<activity android:name=".mulVD" />
<activity android:name=".gujVD" />
<activity android:name=".lahVD" />
<activity android:name=".khiVD" />
<activity android:name=".sahVD" />
<activity android:name=".dgkVD" />
<activity android:name=".pesVD" />
<activity android:name=".bahVD" />
<activity android:name=".balVD" />
<activity android:name=".result" />
<activity android:name=".bioquiz" />
<activity android:name=".chemquiz" />
<activity android:name=".phyquiz" />
<activity android:name=".full" />
</application>
</manifest>
Solved
I have fixed it by deleting all the files in C:\Users\cc.AndroidStudio3.2\system\caches.
I also had the same problem this morning.
I thought this was due to migrating to AndroidX but
It was wrong. It may occur due to improper indexing and building for e.g. the indexing is force stopped. or due to some IDE issues.
The isuue resolved by deleting gradle and .idea folder in project
and clearing cache of Android Studio IDE by D:\Users\ABCD.AndroidStudio3.2\system\caches.
And issue was resolved.
Note:- Please take Project Backups Daily.
Solution for Android studio Arctic Fox and Higher Versions
Steps
Exit Android Studio
Delete caches folder from
C:\Users\{username}\AppData\Local\Google\AndroidStudio2020.3 // For Arctic Fox
Open Android Studio and your code has being Perfect
Check your Android studio version and Target that version folder at below location
C:\Users\{username}\AppData\Local\Google
Note : AppData folder is Hidden in Windows
Erasing the cache of the Android studio will resolve the problem, for that you have to go to:
C:\Users\user\.AndroidStudio3.5\system\caches
(On windows)
and on Mac:
~/.AndroidStudio3.5/system/caches
Delete all the files there and restart the Android studio.
I solved that by
Close project you are working on
//This enables deleting all cache files
Close android studio
navigate to .AndroidStudio folder and then sytem then cache
delete the cache
Go to your project folder delete delete gradle and .idea folder
delete app.iml file too
import project dont open as exixting.
Boom you done.
Delete caches folder of the android studio
Solutions for android studio 3.6 or below android studio 3.6
C:\Users\{user}\.AndroidStudio{version}\system\caches
And above android studio 3.6 or android studio arctic fox
C:\Users\{user}\AppData\Local\Google\AndroidStudio{version}\cache
Close android studio then delete the cache found in
C:\Users\**user**\.AndroidStudio3.6\system\caches
Important not to modify a file before having deleted the android studio cache
If you modify a file you risk not being able to recover your old code
Rename your project folder and delete .gradle and .idea file inside project folder
I am also facing the same issue so i am copy the files from Project location which is corrupted. In my case, there is list of files corrupted due to module added in Login Activity
build.gradle (Project)
build.gradle (App-level)
AndroidManifest.xml
activity_login.xml
ActivityLogin
Steps to solve the problem
I have deleting .iml and .idea file then restart the Android Studio.
Paste the content from Project Location which is corrupted
Commenting the code in which module classes available
Run the application
If you are using git then rollback the changes in corrupted files as copy-paste process as done in Step-2
Above one process is working for me.
It's only a project cache problem (if you see all files in Notepad, it will look fine. No file is corrupt.).
I have 100% working solution.
Close Android Studio
Copy project folder
Rename new project folder
Re-start Android Studio
File->New-> Import from new folder
Delete old folder.

VideoCastControllerActivity: ActivityNotFoundException

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.newco.cooltv.qa/com.google.android.libraries.cast.companionlibrary.cast.player.VideoCastControllerActivity}; have you declared this activity in your AndroidManifest.xml?
i am using cast companion library and tried both way
(1) Add this library from jCenter repo by adding the following line to your project's dependencies:
(2) Use the GitHub source and include that as a module dependency by following these steps:
Both are failing with above exception after call to
loadRemoteMedia(mediaInfo, 0, true);
in build.gradle i have specified below dependencies
// lib for chromecast
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:mediarouter-v7:23.3.0'
compile 'com.google.android.gms:play-services-cast:9.0.2'
compile project(':CastCompanionLibrary')
I am using Andorid Studio 2.1.2 and updated build.gradle of CCL with
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
Make sure you declare that in your Manifest file, something like:
<activity
android:name="com.google.android.libraries.cast.companionlibrary.cast.player.VideoCastControllerActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>

No resource found that matches the given name (at 'theme' with value '#style/Theme.Intro') when including material-intro in my project

I wanted to add an intro wizard for my app (when you first use it).
I used this library as the source: https://github.com/HeinrichReimer/material-intro
So basically what I did was copying his library folder to my project root location and after building the project I get the following error:
No resource found that matches the given name (at 'theme' with value '#style/Theme.Intro').
More detailed error log:
C:\Users\abhishek rai\AndroidStudioProjects\DonationApp\app\build\intermediates\manifests\full\debug\AndroidManifest.xml
Error:(30, 28) No resource found that matches the given name (at 'theme' with value '#style/Theme.Intro').
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\abhishek rai\AppData\Local\Android\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1
The code in AndroidManifest.xml is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="minor.da.com.donationapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity android:name="minor.da.com.donationapp.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="minor.da.com.donationapp.MaterialIntroActivity"
android:parentActivityName="minor.da.com.donationapp.MainActivity"
android:theme="#style/Theme.Intro" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
<activity android:name="minor.da.com.donationapp.FinishActivity" >
</activity>
<activity
android:name="minor.da.com.donationapp.Front_page"
android:label="#string/app_name" >
</activity>
<activity android:name="minor.da.com.donationapp.SecondPage" />
<activity
android:name="android.support.v7.widget.TestActivity"
android:label="RecyclerViewTestActivity" />
</application>
</manifest>
Copying the source is not what you would normally do if you use an Android library like material-intro and I'm clearly discouraging you to do so.
You should definitely include it as a Gradle dependency as described in its readme:
Put that in your project's build.gradle:
allprojects {
//...
repositories {
//...
maven {
url 'https://jitpack.io'
}
}
}
And then put that in your module's build.gradle:
dependencies {
//...
compile 'com.heinrichreimersoftware:material-intro:1.2.1'
}
If you yet run into troubles then, please update the question to include your Gradle files.

Amazon Device Messaging Stub! Android Studio

I'm trying to integrate Amazon Device Messaging with Android Studio. First I followed (integrating-your-app-with-adm). When I call
ADM adm = new ADM(getActivity());
if (adm.isSupported()) {
// ...
}
There's this output on logcat:
E/AndroidRuntime(24472): java.lang.RuntimeException: Stub!
E/AndroidRuntime(24472): at com.amazon.device.messaging.ADM.(Unknown Source)
So I followed Amazons (Integrating Amazon Libraries with Android Studio ) with the same result.
Then I tried this and this without success.
My AndroidManifest.xml looks like this:
...
<uses-permission android:name="de.mypackage.permission.RECEIVE_ADM_MESSAGE" />
<uses-permission android:name="com.amazon.device.messaging.permission.RECEIVE" />
<permission android:name=".permission.RECEIVE_ADM_MESSAGE" android:protectionLevel="signature" />
...
<application
android:name=".MyPackageApplication"
android:allowBackup="true"
android:allowClearUserData="true"
android:hardwareAccelerated="false"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
...
<service android:name=".service.ADMNotificationService" android:exported="false" />
<amazon:enable-feature android:name="com.amazon.device.messaging" android:required="true" />
<receiver android:name=".service.ADMNotificationService$MessageAlertReceiver"
android:permission="com.amazon.device.messaging.permission.SEND">
<intent-filter>
<action android:name="com.amazon.device.messaging.intent.REGISTRATION" />
<action android:name="com.amazon.device.messaging.intent.RECEIVE" />
<category android:name="de.mypackage"/>
</intent-filter>
</receiver>
...
</application>
The local build.gradle looks like this:
...
dependencies {
...
provided files('libs/amazon-device-messaging-1.0.1.jar')
...
}
May you have an idea?
You probably have something along this lines in your dependencies section:
compile fileTree(include: ['*.jar'], dir: 'libs')
This means you're compiling all jars in libs folder into your app. So probably the answer that says switch compile to provided works, but in addition to provided you do compile for all jars in libs folder anyway.
You would need to remove the fileTree line, and include any jars you have there (excluding amazon-device-messaging-1.0.1.jar) manually.
The solution to fix the crash is to edit the build.gradle (Module:app) file.
Remove the line: compile fileTree(include: ['.jar'], dir: 'libs')*
Go to the libs folder and find out all the jar files you require
Include them one by one for compilation. For example, compile files('libs/ePOS2.jar')
Add ADM jar file provided files('libs/amazon-device-messaging-1.0.1.jar')
Build the project

Categories

Resources