Android null object reference error reading XML file: why? - forms

I got this error when a click the button to take a picture . this was working just fine couple weeks ago . so I dont know whats going on .
error 1 :
Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference
this is how my manifest looks :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.myapp.pers" android:installLocation="auto">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:allowBackup="true" android:label="Myapp">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your api key here " />
<meta-data android:name="com.google.android....." android:value="#integer/google_play_services_version" />
</application>
</manifest>
error 2: if I add this
<provider android:name="android.support.v4.content.FileProvider" android:authorities="com.myapp.pers.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/file_paths"></meta-data>
</provider>
this is the error I got
/Users/...../Droid/obj/Debug/android/manifest/AndroidManifest.xml: Error APT0000: 21: error: Error: No resource found that matches the given name (at 'resource' with value '#xml/file_paths'). (APT0000) (myapp.pers.Droid)

I got my own answer. Just to create a folder named xml inside resources, add a new empty class named file_paths.xml with this content:
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-files-path name="my_images" path="Pictures" />
<external-files-path name="my_movies" path="Movies" />
</paths>

Related

Flutter : firebasemessaging.FlutterFirebaseMessagingService: Targeting S+ (version 31 and above) requires that an explicit value

I want run a existing project. It's fully run on under Android 12 but when I going to run a samsung phone which version is Android 12. Then I get this type of error.
Error :
✓ Built build/app/outputs/flutter-apk/app-release.apk (104.1MB).
Installing build/app/outputs/flutter-apk/app.apk... 3.3s
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install /Users/abir/Documents/Office
Work/appName-App-Old-Version/build/app/outputs/flutter-apk/app.apk: Failure
[INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI:
/data/app/vmdl2043233695.tmp/base.apk (at Binary XML file line #124):
io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService: Targeting S+
(version 31 and above) requires that an explicit value for android:exported be
defined when intent filters are present]
Error running application on SM G781B.
Here is my AndroidManifest.xml file :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="care.appname.health">
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- The Agora SDK requires Bluetooth permissions in case users are using Bluetooth devices.-->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:label="appname"
android:name="${applicationName}"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
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">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</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" />
</application>
</manifest>
I tried android:exported="true" true and false also. But nothing is worked. How can I solve this ?
Add service to application, it's work for me.
<service android:name="io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService" android:exported="true"/>

Android Studio : Client not ready yet... Timed out waiting for process to appear on device

Trying to run my app but it keeps showing the following error. I have tried every available solution on stackoverflow.com but the problem still remain.
I have attached manifest file for reference. Android Studio3.2.1 target SDK-28
12/27 01:36:23: Launching app
$ adb push F:\Android_projects\CaliberGaming\CaliberGaming\app\build\outputs\apk\debug\app-debug.apk /data/local/tmp/com.caliber.mskhan.calibergaming
$ adb shell pm install -t -r "/data/local/tmp/com.caliber.mskhan.calibergaming"
Success
APK installed in 3 s 482 ms
Client not ready yet..
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.caliber.mskhan.calibergaming">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:name=".helper.MyApplication"
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="#xml/backup_descriptor"
tools:ignore="GoogleAppIndexingWarning">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<uses-library android:name="org.apache.http.legacy"
android:required="false" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.razorpay.ApiKey"
android:value="rzp_test_PpOinqLyVBHOcP" />
<activity
android:name=".SplashScreen"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".RegistrationActivity" />
<activity android:name=".Login" />
<activity
android:name=".HomeActivity"
android:label="#string/title_activity_home"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".ProfilePage"
android:parentActivityName=".HomeActivity"
android:windowSoftInputMode="stateAlwaysHidden"/>
<activity
android:name=".CenterActivity"
android:theme="#style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".GamersProfile"
android:parentActivityName=".HomeActivity"
tools:ignore="UnusedAttribute" />
<activity
android:name=".CenterRequestActivity"
android:label="#string/title_activity_center_request" />
<activity
android:name=".FollowList"
android:label="Following" />
<service
android:name=".TimingService"
android:enabled="true"
android:exported="true" />
<activity
android:name=".EventInfoActivity"
android:label="#string/title_activity_event_info"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".TeamProfile"
android:parentActivityName=".HomeActivity"
android:theme="#style/AppTheme.NoActionBar"
tools:ignore="UnusedAttribute" />
<activity
android:name=".PendingActivity"
android:parentActivityName=".HomeActivity"
tools:ignore="UnusedAttribute" />
<activity
android:name=".EventsActivity"
android:parentActivityName=".HomeActivity"
tools:ignore="UnusedAttribute" />
<activity
android:name=".LeaderBoards"
android:parentActivityName=".HomeActivity"
tools:ignore="UnusedAttribute" />
<activity android:name=".ChangePassword" />
<activity
android:name=".ForgotPassword"
android:parentActivityName=".Login"
tools:ignore="UnusedAttribute" />
<activity
android:name=".MatchesDOTA"
android:parentActivityName=".TeamProfile"
tools:targetApi="jelly_bean" />
<activity
android:name=".MatchesCSGO"
android:parentActivityName=".TeamProfile"
tools:targetApi="jelly_bean" />
<activity
android:name=".VerificationActivity"
android:parentActivityName=".Login"
tools:ignore="UnusedAttribute" />
<activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity" />
<activity android:name=".GettingLocation" />
<activity android:name=".SteamLogin"
android:theme="#style/AppTheme.NoActionBar" />
<activity android:name=".PaymentResult" />
<activity android:name=".products" />
<receiver
android:name=".receiver.ConnectivityReceiver"
android:enabled="true">
<intent-filter>
<action
android:name="android.net.conn.CONNECTIVITY_CHANGE"
tools:ignore="BatteryLife" />
</intent-filter>
</receiver>
<service
android:name=".service.LocationService"
android:enabled="true"
android:exported="true" />
<service
android:name=".service.GPSTracker"
android:enabled="true"
android:exported="true" />
</application>
</manifest>

Starting an Android service from a different package

I can't seem to start my android service when the service code is in another package that is not the same package as the MainActivity of the main app.
I have tried many many ways, even the AIDL method, and I can't get it to work at all.
MainActivity code
ServiceIntent.setComponent(new ComponentName("com.service.luna","com.service.luna.VService" ));
bindService(ServiceIntent, mServiceConnection, Context.BIND_AUTO_CREATE);
MainActivty Manifest
<?xml version="1.0" encoding="utf-8"?>
<!-- <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" /> This is set from Gradle -->
<!-- Needed for camera passthrough -->
<!--<uses-permission android:name="android.permission.CAMERA" />-->
<!-- Needed to write thumbs -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Needed to for volume -->
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<!-- Needed for Google Play Services GPS -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.usb.host" />
<!-- Needed for uploading crash reports -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-feature android:glEsVersion="0x00030000" android:required="true" />
<application android:allowBackup="true" android:icon="#drawable/ic_launcher" android:label="#string/app_name"
android:hardwareAccelerated="true" android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen">
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only" />
<!-- singleTask launchMode because we never want multiple copies of the app running, -->
<!-- but we might want to internally spawn other activities -->
<!-- Theme.DeviceDefault.NoActionBar.Fullscreen gives solid black instead of a (bad stereoscopic) gradient on app transition -->
<activity android:name="com.main.luna.MainActivity"
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen"
android:label="#string/app_name"
android:launchMode="singleTask"
android:screenOrientation="landscape"
android:configChanges="screenSize|orientation|keyboardHidden|keyboard"
>
<!-- this filter lets the apk show up as a launchable icon -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="com.service.luna.VService" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.service.luna.VService" android:process=":VServiceRemote" android:exported="true" android:enabled="true">
<intent-filter>
<action android:name="com.service.luna.VService"/>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<receiver android:name="com.main.luna.ConnectivityChangeReceiver" >
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
</intent-filter>
</receiver>
</application>
Service Code
public class VService extends Service implements Serializable{
....
Service Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.service.luna">
<application
android:allowBackup="true"
android:label="#string/app_name"
android:supportsRtl="true">
</application>
When My code finally runs, I receive a
bindService callerProcessName:com.main.luna, calleePkgName: com.service.luna, action: null
Unable to start service Intent { pkg=com.service.luna cmp=com.service.luna/.VService } U=0: not found
The name of the main package is com.main.luna and the service is in package com.service.luna
If someone has solved this before, please let me know.
Try to enable the exported option in your manifest while adding your service ( android:exported="true")
<service android:enabled=["true" | "false"]
android:exported=["true" | "false"]
android:icon="drawable resource"
android:isolatedProcess=["true" | "false"]
android:label="string resource"
android:name="string"
android:permission="string"
android:process="string" >
. . .
</service>
and make sure you are using the Correct name of your Package name
Also check this post having similar situation
How do I start a service which is defined in a different package?

Google Maps API V2 no map

i´ve been searching and testing a lot of code, but i can´t get map show in my app.
I have my api key writed in manifest and in the layout of my activity for google maps, but
i only can see map screen without any map, only google logo and grill, i can zoom in and out but no any map view and no zoom buttons, what is the reason?
In LogCat log i only see one error:
E/MapActivity(1024): Couldn't get connection factory client
W/System.err(1024): IOException processing: 26
W/System.err(1024): java.io.IOException: Server returned: 3
W/System.err(1024):at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
Here ismy code.
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.emapps.alarmmap"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<permission
android:name="com.emapps.alarmmap.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<permission
android:name="com.emapps.alarmmap.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.emapps.alarmmap.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.emapps.alarmmap.permission.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCES_NETWORK_STATE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppBaseTheme" >
<activity
android:name="com.emapps.alarmmap.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBxdPiMVTg5_XgRAitoQ5XGyFL8sBTS79A" />
</activity>
<uses-library
android:name="com.google.android.maps" />
<activity
android:name=".MapsView"
android:label="#string/title_activity_maps_view" >
</activity>
</application>
</manifest>
Layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="AIzaSyBxdPiMVTg5_XgRAitoQ5XGyFL8sBTS79A"/>
</LinearLayout>
And Activity.java:
package com.emapps.alarmmap;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class MapsView extends MapActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
}
#Override
protected boolean isRouteDisplayed() {
return false;
}
}
I know that this capture is from API V1,im using APi V2,it is only for reference of my problem.
http://img513.imageshack.us/img513/4061/5ay7.jpg
I have tried on AVD and Phones with same result.
Sorry for my english and thanks in advance!
You are mixing deprecated Google Maps Android API v1 with new API v2. Remove all you code and start by following this: https://developers.google.com/maps/documentation/android/start

Android: permissions missing name and tags

I am quite new to Android programming and am attempting to create an app, but I wanted to make sure that I have everything correct and error free before I do. I have the following errors in my manifest file: missing name attribute in element ....and tag permission missing required attribute name. I thought I did have a name in permission ("#string/app_name") but the error is still there! here is a copy of the code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="s.p.cunningham.checkyournumberslotteryapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<permission android:name="#string/app_name"></permission>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="s.p.cunningham.checkyournumberslotteryapp.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>
Delete the whole tag. It is not a requirement in most of the cases, but god know's why comes as default when you create a new android application project.
If it isn't required, you can delete that tag... if you want to add any permission, then , delete that and use
<uses-permission
android:name="your permission....."
/>