I want to use GoogleMap in my project, I've used these codes before and it works find but now it doesn't work and show the the error that it cannot resolve googleMap
this is my code :
public class MapViewDialog {
Activity act;
String url;
private GoogleMap googleMap;
and other codes in my activity either ;
MapView mMapView = (MapView) dialog.findViewById(R.id.mapView);
this is my layout code :
<com.google.android.gms.maps.MapView
android:id="#+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
this is my gradle file :
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.persiandesigners.market"
minSdkVersion 14
targetSdkVersion 27
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation ('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2') {
exclude module: 'support-v4'
}
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.shell-software:fab:1.1.2'
implementation 'com.alirezaafkar:sundatepicker:2.0.8'
implementation 'me.dm7.barcodescanner:zxing:1.9'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.3'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.daimajia.slider:library:1.1.5#aar'
implementation 'com.squareup.picasso:picasso:2.5.2'
}
I've tried every thing, I cleaned the project, rebuild, invalidate but the error is still on
how can I stop this and solve this issue?
this is my manifest :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.xxx.market"
android:installLocation="auto"
android:versionCode="1"
android:versionName="1">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<permission
android:name="com.xxxx.market.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:name="com.xxxx.market.ParseApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="MYCODE" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
....
Related
I'm new this Android world, and I'm facing a very peculiar issue these days and hence wanted to share with you. Please guide me if you know the solution.
I've installed and configured wampserver (mysql, php, apache) in remote Azure VM and I've opened all the ports for access. Please see the pics for Inbound and Outbound access.
Now the issue is: When I installed app in mobile (debug mode) through android studio and data cable, then it can both insert and fetch/download data from remote mysql db (through all php api scripts)… that means no issues in my app, php code, azure vm setup and access to it.
But when I published the same app in playstore and downloaded from there and installed in my same mobile, then its not able to fetch data, however it can insert data only into same mysql db. While fetching all php-apis are returning only null values, because of which all my recycler views are showing in mobile but with no data.
Anything should I take care in permission or in manifest file or where im missing ? please let me know if you know the answer. Thank you very much all in advance.
FYI, manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission-sdk-23 android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:dataExtractionRules="#xml/data_extraction_rules"
android:fullBackupContent="#xml/backup_rules"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:preserveLegacyExternalStorage="true"
android:requestLegacyExternalStorage="true"
android:roundIcon="#mipmap/ic_launcher"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
tools:targetApi="31">
build.gradle file:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}
android {
namespace 'com.project.localshop'
compileSdk 33
defaultConfig {
applicationId "com.project.localshop"
minSdk 21
targetSdk 33
versionCode 5
versionName "3.2.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.annotation:annotation:1.5.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'com.google.firebase:firebase-auth:21.1.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.github.bumptech.glide:glide:4.14.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'com.github.smarteist:autoimageslider:1.4.0'
implementation 'com.etebarian:meow-bottom-navigation-java:1.2.0'
implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation "com.google.code.gson:gson:2.8.6"
implementation 'com.google.android.material:material:1.9.0-alpha01'
implementation 'com.karumi:dexter:6.2.3'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
//noinspection GradleCompatible
implementation 'com.android.support:design:27.1.0'
implementation "com.airbnb.android:lottie:5.2.0"
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.sothree.slidinguppanel:library:3.4.0'
implementation 'com.android.volley:volley:1.2.1'
implementation 'androidx.browser:browser:1.5.0'
//implementation 'com.cashfree.pg:android-sdk:1.7.28'
implementation platform('com.google.firebase:firebase-bom:31.2.2')
implementation 'com.google.firebase:firebase-analytics'
}
I m building Android wear application but I have this error if I try to compile my application:
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform artifact 'design.aar (com.android.support:design:28.0.0)' to match attributes {artifactType=android-res}.
> Execution failed for ExtractAarTransform: C:\Users\michele.castriotta\.gradle\caches\modules-2\files-2.1\com.android.support\design\28.0.0\bef882d1796b085fa89a5f1cec42a8edd2351e6c\design-28.0.0.aar.
> java.io.IOException: Unable to delete file: C:\Users\michele.castriotta\.gradle\caches\transforms-2\files-2.1\b1d8b4b40a44b6d16bbcc853f378a37d\design-28.0.0\jars\classes.jar
* 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.
==============================================================================
This is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.medicinanucleare.cardio"
minSdkVersion 26
targetSdkVersion 28
versionCode 4
versionName "1.3"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
implementation 'com.google.android.support:wearable:2.4.0'
implementation 'com.google.android.gms:play-services-wearable:16.0.1'
implementation 'com.android.support:percent:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:wear:28.0.0'
compileOnly 'com.google.android.wearable:wearable:2.4.0'
implementation 'com.neovisionaries:nv-bluetooth:1.7'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'joda-time:joda-time:2.9.6'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.5.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.0'
implementation fileTree(include: ['*.jar', '*.so', '*.aar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.dagger:dagger:2.0'
annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
implementation('com.github.jd-alexander:library:1.1.0') {
exclude(group: 'com.android.support', module: 'support-annotations')
exclude(group: 'com.google.android.gms', module: 'play-services-base')
exclude(group: 'com.google.android.gms', module: 'play-services-basement')
exclude(group: 'com.google.android.gms', module: 'play-services-maps')
}
implementation('com.mikepenz:materialdrawer:5.7.0#aar') {
transitive = true
}
// Google Play Services
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.neovisionaries:nv-bluetooth:1.7'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'org.apache.commons:commons-math:2.2'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'net.lingala.zip4j:zip4j:1.3.2'
implementation 'joda-time:joda-time:2.9.6'
implementation 'com.googlecode.efficient-java-matrix-library:core:0.26'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
//Job Scheduler and MQTT
implementation 'com.birbit:android-priority-jobqueue:2.0.1'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
testImplementation 'junit:junit:4.12'
//Fcm Integeration
implementation 'com.google.firebase:firebase-messaging:18.0.0'
implementation files('libs/GraphView-4.0.1.jar')
implementation 'com.idevicesinc:sweetblue:4.0.0#aar'
implementation 'io.paperdb:paperdb:2.6'
}
This is my AndroidManifest file:
<?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.example.firebasewatchapp">
<uses-feature android:name="android.hardware.type.watch" />
<uses-permission
android:name="android.permission.BLUETOOTH_PRIVILEGED"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<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_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-feature
android:name="android.hardware.bluetooth_le"
android:required="true" />
<uses-feature
android:glEsVersion="0x00030000"
android:required="true" />
<application
android:networkSecurityConfig="#xml/network_security_config"
android:name=".Global"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat.DayNight.NoActionBar"
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning"
android:launchMode="singleInstance">
<uses-library android:name="org.apache.http.legacy" android:required="false" />
<activity android:name=".activities.RadioActiveAlertDialog" />
<meta-data
tools:replace="android:value"
android:name="android.support.VERSION"
android:value="28.0.0" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity android:name=".activities.VitalStatsActivity" />
<uses-library
android:name="com.google.android.wearable"
android:required="true" />
<meta-data
android:name="com.google.android.wearable.standalone"
android:value="true" />
<activity
android:name=".activities.HomeActivity"
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>
How can I fixed it?
I am uploading my application in the Android PlayStore and it is getting rejected because of SMS permission in it, but in my Manifest.xml file, there is no SMS permission added.
After having a conversation with the Google team they said that there is permission available of SMS and I am unable to find it.
Below is the screenshot provided by the Google Team and it has SMS permission in there.
My Manifest file looks like this
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.msonline.android">
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application
android:name=".ApplicationClass"
android:allowBackup="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/MSOAppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning"
tools:replace="android:allowBackup,android:icon,android:label,android:theme">
//Other declarations of Activities
</application>
</manifest>
Any Help is appreciable thanks in Advance.
Edit #1
build.gradle
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "package name"
minSdkVersion 16
targetSdkVersion 28
versionCode 31
versionName "4.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
debuggable false
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:recyclerview-v7:28.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true
}
implementation 'pub.devrel:easypermissions:1.3.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.1'
implementation 'com.onesignal:OneSignal:3.10.3'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.firebase:firebase-config:16.4.1'
implementation "com.google.firebase:firebase-core:16.0.8"
implementation 'com.facebook.fresco:fresco:1.7.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation('com.payumoney.sdkui:plug-n-play:1.0.0') {
transitive = true;
exclude module: 'payumoney-sdk'
}
implementation 'com.payumoney.core:payumoney-sdk:7.1.0'
// implementation 'com.google.android.gms:play-services-ads:17.1.1'
implementation 'com.google.android.gms:play-services-ads:17.2.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation project(':libraryMobilePaymentSDKLive')
}
apply plugin: 'com.google.gms.google-services'
Manifest of Lib added
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.atom.library_mobilepaymentsdk"
android:versionCode="3"
android:versionName="3.3" >
<application
android:allowBackup="true"
android:icon="#drawable/process"
android:label="atom payment SDK"
android:theme="#android:style/Theme.Holo.Light" >
</application>
Third party libraries also contribute to your permission tree. In your case the below library that you are using is having RECEIVE_SMS declared in manifest.
com.payumoney.sdkui:plug-n-play:1.0.0
You can check the sdk manifest from sdk's git repo using below this link.
There is RECEIVE_SMS defined in manifest.
<uses-permission
android:name="android.permission.RECEIVE_SMS"
android:protectionLevel="signature" />
What you can try to do is to remove this permission, first declare in your manifest tools:node="remove" then add
<uses-permission android:name="android.permission.RECEIVE_SMS" tools:node="remove" />
The final merged manifest will not have RECEIVE_SMS
Surely you are using a third party library that add this permission.
What you can try to do is to remove this permission, first declare in your manifest tools:node="remove" then add
<uses-permission android:name="android.permission.RECEIVE_SMS" tools:node="remove" />
The final merged manifest will not have RECEIVE_SMS
My app is not visible on any mobile device. Installs with no problem from the APK file, works good, but for some reason, Google Play doesn't list it.
When I look at google play of the computer the error is: This app is not compatible with your device.
When I look at Google Play Console - device catalog, the compatible devices is 0.
Any suggestions for this?
The app's manifest:
<?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="br.com.tecmafandroid.projeto.tecmaf">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature
android:name="android.hardware.camera2"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_tecmaf"
android:roundIcon="#mipmap/ic_tecmaf_round"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
...
</application>
</manifest>
build.gradle(app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "br.com.XXXandroid.projeto.XXX"
minSdkVersion 15
targetSdkVersion 27
versionCode 2 subindo novas versões
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//dependencias firebase
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.firebaseui:firebase-ui-storage:0.6.0'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:27.1.1'
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 fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.rtoshiro.mflibrary:mflibrary:1.0.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.github.jd-alexander:LikeButton:0.2.3'
}
apply plugin: 'com.google.gms.google-services'
<uses-feature
android:name="android.hardware.camera2"
android:required="true" />
It will be listed for device which only has Camera 2
In order to list for all devices,
make the android:required = "false" and handle for the devices which doesnt have Camera 2.
I'm building an application that has a shared library and two applications that share this library.
As soon as the application starts the logcat shows D/AndroidRuntime: Shutting down VM.
If I debug the application it does not launch my MainActivity (LoginActivity). The application crashs after return from attachBaseContext(Context base) in the Application Class.
This is not a simple case of NPE, the problem is that the VM is Shutting down and the only debuggable part is the Global.attachBaseContext that runs OK and after that the Logcat message is shown.
LOGCAT
I/MultiDex: VM with version 2.1.0 has multidex support
I/MultiDex: install
I/MultiDex: VM has multidex support, MultiDex support library is disabled.
I/MultiDex: install
I/MultiDex: VM has multidex support, MultiDex support library is disabled.
D/AndroidRuntime: Shutting down VM
--------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
Process: br.com.cfb.dogwalktracker_dogwalker, PID: 17406
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean
java.lang.String.equals(java.lang.Object)' on a null object reference at android.app.ActivityThread.installProvider(ActivityThread.java:5140)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
GradeBuild shared library
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
minSdkVersion 17
targetSdkVersion 25
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'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
compile 'com.android.support:multidex:1.0.1'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v13:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.github.orangegangsters:swipy:1.2.0#aar'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.google.code.gson:gson:2.7'
compile 'org.parceler:parceler:1.0.1'
compile 'org.parceler:parceler-api:1.0.1'
compile 'com.google.android.gms:play-services-ads:11.0.4'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-places:11.0.4'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
}
Gradebuild (from dog walker Application)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "br.com.cfb.dogwalktracker_dogwalker"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.android.support:multidex:1.0.1'
})
compile project(':DogWalkTrackerShared')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.android.gms:play-services-plus:11.0.4'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
GradeBuild (From user Application)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "br.com.cfb.dogwalktrackeruser"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
compile 'com.android.support:multidex:1.0.1'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v13:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.github.orangegangsters:swipy:1.2.0#aar'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.google.code.gson:gson:2.7'
compile 'org.parceler:parceler:1.0.1'
compile 'org.parceler:parceler-api:1.0.1'
compile 'com.google.android.gms:play-services-ads:11.0.4'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-places:11.0.4'
compile 'com.android.support:support-v4:25.3.1'
compile project(':DogWalkTrackerShared')
testCompile 'junit:junit:4.12'
}
GLOBAL
public class Global extends Application {
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Manifest (from dog walker Application)
<?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="br.com.cfb.dogwalktracker_dogwalker">
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-feature android:name="android.hardware.location.gps" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<application
android:name="br.com.cfb.dogwalktrackershared.Global"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name_dogwalker"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:replace="label">
<activity
android:name=".LoginActivity"
android:label="#string/app_name_dogwalker">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".GrantPermissionActivity"
android:label="#string/app_name_dogwalker"/>
<activity
android:name=".NavigationDrawer"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar" />
<receiver
android:name=".BootReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name="br.com.cfb.dogwalktrackershared.IncomingSms">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
<receiver android:name=".AlarmReceiver" />
</application>
</manifest>
Manifest (From user Application)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.com.cfb.dogwalkertrackeruser">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<!--
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" />
<application
android:name="br.com.cfb.dogwalktrackershared.Global"
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="br.com.cfb.dogwalktracker_dogwalker.LoginActivity"
android:label="#string/app_name_dogwalker">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="br.com.cfb.dogwalktracker_dogwalker.GrantPermissionActivity"
android:label="#string/app_name_dogwalker"/>
<activity
android:name=".NavigationDrawer"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar" />
<!--
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/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
</application>
</manifest>
Manifest from Shared Library
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.com.cfb.dogwalktrackershared">
<uses-permission android:name="android.permission.INTERNET" />
<application android:allowBackup="true"
android:label="#string/app_name"
android:supportsRtl="true">
</application>
</manifest>