My App not working on Marshmallow but works on Nougat? - android

I m new to Android development. I have developed an app using the android studio. The problem is that after generating the signed APK, when I m trying to install the app on an android device with MARSHMALLOW on it, it's not getting installed showing error message "APP CANNOT BE INSTALLED" message, but it gets installed on an android device with NOUGAT on it instead I have set minSDKVersion to 19.
Here's my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.adityakumarsingh.arduinobot"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="26" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:screenOrientation="portrait"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".WelcomeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Splash"
android:screenOrientation="portrait"
android:theme="#style/SpalshTheme">
</activity>
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"></activity>
<activity
android:name=".Accelerometer"
android:parentActivityName=".MainActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
<activity
android:name=".BluetoothConnection"
android:screenOrientation="portrait"
android:theme="#style/AppTheme" />
<activity
android:name=".GameMode"
android:parentActivityName=".MainActivity"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
<activity
android:name=".About"
android:parentActivityName=".MainActivity"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
<activity
android:name=".Voicerecog"
android:parentActivityName=".MainActivity"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
</application>
</manifest>
And here's my build file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.adityakumarsingh.arduinobot"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-
layout:1.0.2'
compile 'io.github.controlwear:virtualjoystick:1.8.0'
compile 'com.github.markushi:circlebutton:1.1'
compile 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:design:26.1.0'
}
What to do? Any help would be appreciated.Thanks

Ok it mostly is the signature Which is causing issues. Try having a v2 plus v1 signature while signing the apk instead of just any one. I've seen this error when i was just using the v2 method. Adding the v1 signature will help.
V2 signatures sign the module and work for nougat and more. It'll not work on older versions of android so you'll have to use the v1 for full apk signature as well. This will let older versions install it with verification using v1 and nougat and above should still use v2. Use both. Details on this can be found at their site:
https://source.android.com/security/apksigning/v2
Also make sure that there isn't any already installed apk with the same version number as the one you are trying to install. It'll fail if it's already installed and the version number is the same.

Related

App not installed android studio

I am developing an app for a long time and now I'm trying to install generated apk on my phone, but there is error occurs. But it works fine when I run it on emulator or wi-fi adb connection with the phone. I'm already read a lot of manuals, but nothing helps me yet. I have no slightest idea why it's happening.
Here is my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ru.scapegoats.checkers">
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".activity.game.Game" android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.main.Main" />
</activity>
<activity android:name=".activity.bluetooth.BluetoothMenu" android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.main.Main" />
</activity>
<activity android:name=".activity.session.SessionActivity" android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.main.Main" />
</activity>
<activity android:name=".activity.createsession.CreateSessionActivity" android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.internet.InternetMenu" />
</activity>
<activity android:name=".activity.properties.Properties" android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.main.Main" />
</activity>
<activity android:name=".activity.internet.InternetMenu" android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.main.Main" />
</activity>
<activity android:name=".activity.autorization.AutorizationActivity" android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.main.Main" />
</activity>
<activity android:name=".activity.registration.RegistrationActivity" android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.main.Main" />
</activity>
<activity android:name=".activity.main.Main" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.VIEW"/>
</intent-filter>
</activity>
</application>
</manifest>
Here is my build gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-P'
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "ru.scapegoats.checkers"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
checkReleaseBuilds false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
ext {
androidSupportVersion = "27.0.1"
gmsVersion = "12.0.1"
retrofitVersion = "2.1.0"
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('androidx.test.espresso:espresso-core:3.1.0-alpha2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'androidx.appcompat:appcompat:1.0.0-alpha3'
testCompile 'junit:junit:4.12'
implementation 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
implementation "com.squareup.retrofit2:retrofit:${retrofitVersion}"
implementation "com.squareup.retrofit2:converter-gson:${retrofitVersion}"
implementation "com.squareup.retrofit2:adapter-rxjava:${retrofitVersion}"
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.5.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
implementation 'com.google.android.material:material:1.0.0-alpha3'
}
I'm tried to run the app on different devices but error always the same.
add android:testOnly="false" and android:debuggable="true" in your manifest section
<application
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:testOnly="false"
android:debuggable="true">
after this clean and Rebuild your project and try to install your apk again.
hope it will work..!! it works for me.
I had changed my LAUNCHER activity to exported=false by mistake. Then removed it and fixed :).
I changed complileSdkVersion to 28 and now it's installs fine.
Build -> Build Bundle (s) / APK (s) -> Build APK (s)

Google Play Compatibility Issue

I have released an app on Google Play that has a minimum API level of 17 (Android 4.2).
I have a test phone running Android 4.4.2.
The app is currently released only as beta. When I attempt to download it, it says its not compatible.
Has anyone got any ideas what could cause this?
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.delaneybiometrics.delaneymobile"
minSdkVersion 17
targetSdkVersion 23
versionCode 9
versionName "0.9"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'org.apache.httpcomponents:httpcore:4.4.3'
compile 'org.apache.httpcomponents:httpclient:4.5'
}
Here is the Manifest...
<?xml version="1.0" encoding="utf-8"?>
<!--
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.CAMERA" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!--<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>-->
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.front"
android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<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=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<!--
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" />
<activity
android:name=".PunchActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".OnSiteActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".RegisterActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".TourActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
To fix, remove the <uses-feature android:name="android.hardware.camera.autofocus" /> tag from your manifest. But dont worry, as the docs say below, your app will still work properly
http://developer.android.com/reference/android/hardware/Camera.AutoFocusCallback.html
Devices that do not support auto-focus will receive a "fake" callback
to this interface. If your application needs auto-focus and should not
be installed on devices without auto-focus, you must declare that your
app uses the android.hardware.camera.autofocus feature, in the
manifest element.

Why is my Android App unsupported for ALL devices on google play?

I published an Android app on the google play store but it says that it is incompatible with ALL devices:
Why is this? Just before this, I published another app and it really wasn't that much different from this one but it is compatible with almost all devices.
This is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.yy" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/app"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- register our ContentProvider -->
<provider
android:name=".data.app"
android:authorities="#string/content_authority"
android:exported="false"
android:syncable="true" />
<activity
android:name=".DetailActivity"
android:label="#string/title_activity_detail"
android:parentActivityName=".FavoritesActivity"
android:launchMode="singleTask">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xxx.yyy.MainActivity" />
>
</activity>
<activity
android:name=".FavoritesActivity"
android:label="#string/title_activity_favorites"
android:parentActivityName=".MainActivity"
android:launchMode="singleTask">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xxx.yyy.MainActivity" />
</activity>
</application>
</manifest>
And this is my gradle.build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.xxx.yy"
minSdkVersion 10
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'org.json:json:20150729'
compile 'org.apache.directory.studio:org.apache.commons.codec:1.8'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.android.support:design:22.2.0'
}
I'm really lost here because I only have one permission, INTERNET..
I found out the culprit!
It was this line in my gradle file:
compile 'org.apache.directory.studio:org.apache.commons.codec:1.8'
This weird: Native platforms thing was showing up before all because of that gradle dependency!
Which does not make sense for me... I guess I have to find another dependency or something. Could someone explain to me why a dependency like that would cause this to happen?
I removed that line and upon reuploading my APK I now see this:
You appear to have an extra > in your manifest --
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xxx.yyy.MainActivity" />
> <==== DELETE THIS
</activity>
<activity
Not sure why your even able to make a build with that, but I tested a similar scenario and it made an APK for me. I would guess when you upload the .apk that is messing with google play's parsing for device compatibility.

Application not Installed in Android

I developed an application, this application has 2 versions. when Install new version Application on old version.it shows Application Not Installed.
my manifest :
<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.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/smsbox_2_logo"
android:label="#string/app_name"
android:largeHeap="true"
android:screenOrientation="portrait"
android:theme="#style/AppTheme">
<activity
android:name=".activities.Main_Page"
android:label="#string/app_name"
android:screenOrientation="portrait"></activity>
<activity
android:name=".activities.addSMS_Page"
android:label="#string/title_activity_new_sms"
android:screenOrientation="portrait" />
<activity
android:name=".activities.ShowSMS_Page"
android:label="#string/title_activity_show_sms__page"
android:screenOrientation="portrait" />
<activity
android:name=".activities.MySMS_Page"
android:label="#string/title_activity_my_sms__page"
android:screenOrientation="portrait" />
<activity
android:name=".activities.Fav_Page"
android:label="#string/title_activity_fav__page"
android:screenOrientation="portrait" />
<activity
android:name=".activities.login_Page"
android:label="#string/title_activity_login__page"
android:screenOrientation="portrait"></activity>
<activity
android:name=".activities.register_Page"
android:label="#string/title_activity_register__page"></activity>
<activity
android:name=".activities.category_Page"
android:label="#string/title_activity_register__page"></activity>
<activity
android:name=".activities.category_select_Page"
android:label="#string/title_activity_register__page"></activity>
<activity
android:name=".activities.about_Page"
android:label="#string/title_activity_about__page"></activity>
<activity
android:name=".activities.setting_Page"
android:label="#string/title_activity_setting__page"></activity>
<activity
android:name="com.tellfa.smsbox.activities.splash_Page"
android:label="#string/title_activity_splash__page">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.connectus_Page"
android:label="#string/title_activity_connectus__page"></activity>
</application>
</manifest>
Build.Gradle code :
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.tellfa.smsbox"
minSdkVersion 14
targetSdkVersion 22
versionCode 10
versionName "2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
how to fix it ?
Just uninstall old Application and then install new version
you probably used a different keystore file, you need to uninstall the app and re-install it
Set minimum and target Sdk versions in mainfest
the keystore should be same for two versions. in this case you have to un-install previous version and reinstall new version will fix the issue. or use the same keystore

How to unimport a project from android studio

I downloaded a library from github and imported it. I don't think it was done right. How to unimport it. I deleted the project from windows file explorer. Now when I build I get Task 'compileDebugSource' not found in project:BackgroundMailLibrary.
I just found that that lib is deprecated and want to use the new one. Please help.
.
I removed the library by clicking on it and selecting edit configuration and clicking the - mark. But am still getting the cross mark
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc2"
defaultConfig {
applicationId "com.prematixsofs.taxiapp"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
//compile files('libs/mail.jar')
}
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-library android:name="com.google.android.maps" />
<service
android:name=".KioskService"
android:exported="false" />
<uses-permission android:name="android.permission.GET_TASKS" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppFullScreenTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustPan" >
</activity>
<activity
android:name=".RegisterActivity"
android:label="#string/title_activity_register"
android:windowSoftInputMode="adjustPan" >
</activity>
<activity
android:name=".BaseActivity"
android:label="#string/title_activity_base" >
</activity>
<activity
android:name=".LoginActivity"
android:label="#string/title_activity_login"
android:windowSoftInputMode="stateHidden" >
</activity>
<activity
android:name=".BlankActivity"
android:label="#string/title_activity_blank" >
</activity>
<activity
android:name=".DateVehiclePicker"
android:label="#string/title_activity_date_vehicle_picker" >
</activity>
<activity
android:name=".MailImage"
android:label="#string/title_activity_mail_image" >
</activity>
<activity
android:name=".EditUserDetails"
android:label="#string/title_activity_edit_user_details" >
</activity>
<activity
android:name=".DynamicTextViewActivity"
android:label="#string/title_activity_dynamic_text_view" >
</activity>
<activity
android:name=".SplashScreenActivity"
android:label="SplashScreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".KioskService"
android:exported="false" />
<activity
android:name=".DisplayBookingHistory"
android:label="#string/title_activity_display_booking_history" >
</activity>
</application>
If it is a library dependence
go to file-->project structure-->on the right side tab select dependency and remove that
you can also remove it from you build.gradle file
if it is imported as a module
go to file-->project structure-->on top left corner click the (-) mark
In Android studio window,
Remove from File > Project Structure > Dependencies > - button. Then if it is still there you can remove the module by going to the settings.gradle file and removing it from the include line.
If you have disable run button than follow
Click Run on the menu and then Edit Configurations then click on Android Application on the left and click the + button. Choose Android Application from the pop-up menu. Then pick the module (its normally app or something like that). Then click apply and ok.
If you have more errors after that, try to re-import the project in Android Studio.

Categories

Resources