AndroidManifest.xml does not have the right value - android

I'm trying to display GoogleMaps inside a nested fragment:
// inflate and return the layout
View v = inflater.inflate(R.layout.fragment_nearby_map, container, false);
mMapView = (MapView) v.findViewById(R.id.mapView);
But I'm getting an exception that seem to have to do with the play service version somehow as can be seen from the exception: Expected 7095000 but found 4323000
04-19 17:20:20.841 20612-20612/com.mahlzeit E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.mahlzeit, PID: 20612
java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 7095000 but found 4323000. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
at com.google.android.gms.common.GooglePlayServicesUtil.zzJ(Unknown Source)
at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
at com.google.android.gms.maps.internal.zzx.zzad(Unknown Source)
I'm not sure what I have to do here since the version.xml file does contain the value 7095000:
version.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="google_play_services_version">7095000</integer>
</resources>
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="#drawable/ic_app"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/google_maps_key" />
<activity> <!-- ... -->

Maybe you do not need your own:
<integer name="google_play_services_version">7095000</integer>
and should use the one provided in library. Try removing this entry.

Try Clean the project and rebuild

Try to find that if there is any another 'version.xml' file available and in that file replace 4323000(which value you got in error) to 7095000(which value you got in error).

Related

java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException

Suddenly, I tried to open my application and the app did not wanted to start. It stopped before opening it. I started searching and tried all of other similar questions, but none worked. this is my log:
2020-07-18 22:27:41.652 21042-21042/? I/art: Not late-enabling -Xcheck:jni (already on)
2020-07-18 22:27:41.652 21042-21042/? W/art: Unexpected CPU variant for X86 using defaults: x86
2020-07-18 22:27:41.878 21042-21042/? W/System: ClassLoader referenced unknown path: /data/app/com.ainimei.remotemouse-1/lib/x86
2020-07-18 22:27:41.900 21042-21042/? D/AndroidRuntime: Shutting down VM
2020-07-18 22:27:41.900 21042-21042/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ainimei.remotemouse, PID: 21042
java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
******************************************************************************
* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
* should follow the instructions here: *
* https://googlemobileadssdk.page.link/admob-android-update-manifest *
* to add a valid App ID inside the AndroidManifest. *
* Google Ad Manager publishers should follow instructions here: *
* https://googlemobileadssdk.page.link/ad-manager-android-update-manifest. *
******************************************************************************
at android.app.ActivityThread.installProvider(ActivityThread.java:5856)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.IllegalStateException:
******************************************************************************
* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
* should follow the instructions here: *
* https://googlemobileadssdk.page.link/admob-android-update-manifest *
* to add a valid App ID inside the AndroidManifest. *
* Google Ad Manager publishers should follow instructions here: *
* https://googlemobileadssdk.page.link/ad-manager-android-update-manifest. *
******************************************************************************
at com.google.android.gms.internal.ads.zzyz.attachInfo(com.google.android.gms:play-services-ads-lite##19.2.0:33)
at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite##19.2.0:3)
at android.app.ActivityThread.installProvider(ActivityThread.java:5853)
... 10 more
here is my androidManifest.xml:
note that the code has no meta-data tag. But I never needed it until now. Also my app does not use ads on it.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ainimei.remotemouse">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="#drawable/ainimei_logo_icon"
android:label="#string/app_name"
android:roundIcon="#drawable/ainimei_logo_icon"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".SelectConnectionType" />
<activity android:name=".ControlBluetoothConnection" />
<activity android:name=".Connection" />
<activity
android:name=".KeyboardActivity"
android:screenOrientation="landscape" />
<activity
android:name=".ProfileSettingsActivity"
android:screenOrientation="portrait" />
<activity
android:name=".loginActivity"
android:screenOrientation="portrait" />
<activity
android:name=".buyPremiumActivity"
android:screenOrientation="portrait" />
<activity
android:name=".select_control"
android:screenOrientation="portrait" />
<activity
android:name=".SettingsActivity"
android:screenOrientation="portrait" />
<activity
android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I keep trying anyways.
In your manifest file , inside the application tag put this code
<application>
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
/// pass the key generated from your admob which contains ~(APP ID)
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/> //
</application>
just check whether meta-data tag is out of activity tag
if it is like this
<manifest>
<application>
<activity>
<meta-data>
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-4347201915048498~6120388314"/>
</activity>
</application>
</manifest>
this should be changed to this
<manifest>
<application>
<activity>
</activity>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-4347201915048498~6120388314"/>
</application>
</manifest>

Missing AdActivity in AndroidManifest.xml

I am having this error
I/Ads (21352): Starting ad request.
I/Ads (21352): SDK version: afma-sdk-a-v15090040.14300000.1
I/Ads (21352): This request is sent from a test device.
W/Ads (21352): Could not find com.google.android.gms.ads.AdActivity, please make sure it is declared in AndroidManifest.xml.
W/Ads (21352): Missing AdActivity with android:configChanges in AndroidManifest.xml. You must have the following declaration within the <application> element: <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
D/skia (21352): Program linking failed.
D/skia (21352): Program linking failed.
I tried to resolve the issue as per mentioned in this missing-adactivity-with-android-configchanges and AdView - Missing adActivity with android:configChanges in AndroidManifest.xml but it having same issue.
in profile/AndroidManifest I have
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="puns.jokes.org.jokespuns">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
in main/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="puns.jokes.org.jokespuns">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Jokes and Puns"
android:icon="#mipmap/ic_launcher">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in #style/LaunchTheme). -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-<app-id>"/>
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
What I am doing wrong here?
I was receiving the same error.
My solution to this problem was to update in the grandle build at the application level.
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.google.gms: google-services: 4.2.0'
My AndroidManifest:
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-***********~**********"/>
I hope it helps. regards

error AppCompat you need use app.themecompat

referring to thread Unfortunately, 'app_name' has stopped, I solved it, I get a new error:
FATAL EXCEPTION: main
Process: com.cursoandroid.miarrayadapter, PID: 1253
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cursoandroid.miarrayadapter/com.cursoandroid.miarrayadapter.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread
Mi main Activity is already app.compat
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cursoandroid.miarrayadapter" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat" >
<activity
android:theme="#style/Theme.AppCompat"
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>
</manifest>
But I´m geeting to execute the application:
I dont understand it?
Since you are using the appcompat library the xmlns attribute in menu_main.xml should be:
<menu xmlns:yourapp="http://schemas.android.com/apk/res-auto" .... >
as given in the android documentation:
http://developer.android.com/guide/topics/ui/actionbar.html

error Api key not found

i am trying to use google maps in my app, i am using google play services in app
MapViewActivity:
public class MapsViewActivity extends FragmentActivity {
// Google Map
private GoogleMap googleMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.maps);
try {
// Loading map
initilizeMap();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* function to load map. If map is not created it will create it for you
* */
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
}
XMl:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
and getting the following errors :
08-05 16:41:54.384: E/dalvikvm(24979): Could not find class 'gpq', referenced from method gpr.a
08-05 16:41:54.384: W/dalvikvm(24979): VFY: unable to resolve new-instance 4090 (Lgpq;) in Lgpr;
08-05 16:41:54.384: D/dalvikvm(24979): VFY: replacing opcode 0x22 at 0x0000
08-05 16:41:54.404: W/dalvikvm(24979): VFY: unable to resolve static field 20875 (t) in Lyo;
08-05 16:41:54.404: D/dalvikvm(24979): VFY: replacing opcode 0x62 at 0x000e
08-05 16:41:54.404: W/dalvikvm(24979): VFY: unable to resolve static field 20875 (t) in Lyo;
08-05 16:41:54.484: E/AndroidRuntime(24979): FATAL EXCEPTION: main
08-05 16:41:54.484: E/AndroidRuntime(24979): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.careandcure/com.example.careandcure.MapsViewActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
08-05 16:41:54.484: E/AndroidRuntime(24979): at com.example.careandcure.MapsViewActivity.onCreate(MapsViewActivity.java:16)
08-05 16:41:54.484: E/AndroidRuntime(24979): at android.app.Activity.performCreate(Activity.java:4538)
08-05 16:41:54.484: E/AndroidRuntime(24979): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1071)
08-05 16:41:54.484: E/AndroidRuntime(24979): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
08-05 16:41:54.484: E/AndroidRuntime(24979): Caused by: java.lang.RuntimeException: API key not found. Check that <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
08-05 16:41:54.484: E/AndroidRuntime(24979): at com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown Source)
manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.careandcure"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<permission
android:name="info.androidhive.googlemapsv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="info.androidhive.googlemapsv2.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Required OpenGL ES 2.0. for Maps V2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.careandcure.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>
<activity android:name="com.example.careandcure.MapsViewActivity" >
</activity>
<!-- Goolge Maps API Key -->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="api_key" />
</application>
</manifest>
I am not getting where I am getting wrong or missing anything and
how to remove please help me in solving this issue.
The Log say you:
Caused by: java.lang.RuntimeException: API key not found. Check that <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
So be sure that you added it in AndroidManifest.xml like in the guide:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="API_KEY"/>
In your manifest file error cause this line
<!-- Goolge Maps API Key -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my api key" />
In value of API key you must add your own API key.
See This link for generate API key
Clearly from your logcat, you have just copy pasted the manifest.xml file. You have to enter your key instead of your API key
Generate your key from google console. And use it in manifest.xml
You will need two metadata for version2 of googlemap
One with api key and another with google service
android:value="#integer/google_play_services_version"
So you should simply copy paste the line. And only try to under stand later.
:-)
Edited:
Change the package name to yours (not of androidhive :-)) Change the line in permission
<permission
android:name="info.androidhive.googlemapsv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
To:
<permission
android:name="com.example.careandcure.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
Also why are you using package name of info.androidhive.googlemapsv2 in uses-permission. Change it to your own package name i.e. com.example.careandcure . Hope it's finally your solution.

Using Android Emulator (eclipse) fails to start the tic-tac-toe example

I am trying to test the tic-tac-toe in eclipse. It compiles and deploys to emulator device (AVD) but no matter what version of Android I use, the application deployed says: Application Stopped. Close it. Is there any specific setting I should follow?
Note: I already setup the Eclipse environment, add libraries, etc.
Thanks!
Here is the log error:
01-16 01:07:35.994: E/AndroidRuntime(883): FATAL EXCEPTION: main
01-16 01:07:35.994: E/AndroidRuntime(883): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.google.cast.samples.tictactoe/com.google.cast.samples.tictactoe.GameActivity}: java.lang.ClassNotFoundException: Didn't find class "com.google.cast.samples.tictactoe.GameActivity" on path: DexPathList[[zip file "/data/app/com.google.cast.samples.tictactoe-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.google.cast.samples.tictactoe-1, /system/lib]]
01-16 01:07:35.994: E/AndroidRuntime(883): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
01-16 01:07:35.994: E/AndroidRuntime(883): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
01-16 01:07:35.994: E/AndroidRuntime(883): at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-16 01:07:35.994: E/AndroidRuntime(883): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.cast.samples.tictactoe.GameActivity" on path: DexPathList[[zip file "/data/app/com.google.cast.samples.tictactoe-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.google.cast.samples.tictactoe-1, /system/lib]]
01-16 01:07:35.994: E/AndroidRuntime(883): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
Thanks Ali. Here is the manifest, but I see there is a match of class and activity.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.cast.samples.tictactoe"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-feature
android:name="android.hardware.wifi"
android:required="true" >
</uses-feature>
<application
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat" >
<activity
android:name=".GameActivity"
android:configChanges="orientation|keyboardHidden"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Exception states that it didn't find your GameActivity class. Check your Manifest and see if the name given there as the launcher activity (GameActivity) matches with the class that you have in your package, check the package names, etc. The exception has nothing to do (at least the piece that you have shown) with Cast.
Thanks for all the help. I solved by silly configuration. I created a libs folder and copied under GoogleCastSDKAndroid.jar (marked as Private Library). Compiled and it worked perfect!
Now, I just learned the casting function can't work because AVD runs a different IP address (in my case registered a 10.0.2.15) than my wifi segment (192.168.1.x). Therefore, the AVD can't see a chrome device.
I hope this last conclusion helps other people. The first was a mistake of configuration.

Categories

Resources