I have prepared a new android development setup in my windows 7 64-Bit machine.
Android Studio Version: 3.5.3
JDK: 1.8.0_231
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
AndroidManufest.java
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
package="com.example.myapplication">
<dist:module dist:instant="true" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
When I install the APK file generated after compilation in emulator (Nexus 6P API 27 x86) it works fine. However, when I am trying to install the same APK file in my phone its not installing. I have already deactivated Play Protect options.
disable wifi and mobile data and get build then install apk on your phone
i seen this issue in my app and It looks like google protect stuff
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Solved my problem.
Related
I install the android studio just run the application it just showing this error iput the code in manifest and bulid gradle, please review it and give me simple solution thanky
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.co`enter code
here`m/apk/res/android"
package="com.example.customerdrawer"
xmlns:tools="http://schemas.android.com/tools">
<application tools:replace="android:allowBackup">
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/Theme.CustomerDrawer"
tools:replace="android:appComponentFactory">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And this is build.gradle file
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.customerdrawer"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-
rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
//noinspection GradleCompatible
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
I have other solutions as per given but nothing changes please Assist Thanks
I am developing an Automotive OS Media app, but for my project, I always get two same icons on my emulator after running. Since my project is an Automotive OS app, there is no android.intent.action.MAIN and android.intent.category.LAUNCHER - I mean, there is no duplicates of them to cause my problem.
My project has two modules - one is Automotive application, another one is Media Service Library (named common). Below are AndroidManifest.xml and build.gradle files for two parts.
AndroidManifest.xml (automotive)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.automotivemusic">
<uses-feature
android:name="android.hardware.type.automotive"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat">
<activity android:name=".SignInActivity">
<intent-filter>
<action android:name="android.intent.action.ACTION_SIGN_IN" />
</intent-filter>
</activity>
<service
android:name=".AutomotiveMusicService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.media.browse.MediaBrowserService"/>
</intent-filter>
</service>
</application>
</manifest>
build.gradle (automotive)
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.example.automotivemusic"
minSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation project(path: ':common')
implementation 'androidx.media:media:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
AndroidManifest.xml (common)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.common">
<application>
<service
android:name="com.example.common.MusicService"
android:exported="true">
<intent-filter>
<action android:name="android.media.browse.MediaBrowserService" />
</intent-filter>
</service>
</application>
</manifest>
build.gradle (common)
plugins {
id 'com.android.library'
}
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.media:media:1.1.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Android automotive platform is showing two icons because your application has two MediaBrowserService(AutomotiveMusicService and MusicService).
The automotive platform scans for Media application installed in the platform based on intent-filter"android.media.browse.MediaBrowserService", hence two icons.
On including implementation 'com.google.firebase:firebase-core:17.0.0'
in my build.gradle(app) my project does not successfully sync.
i've tried cleaning up the project i've tried ,as the error suggests, increasing minSdkVersion to 16 (it gives another error) but nothing worked.
build.gradle(app)
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.saad.error"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
Manifest file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.saad.error">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I just started developing on Android and got that same error. I changed my minSdkVersion from 15 to 16, and then it built and ran.
I'm not an expert but I had the same problem just now and I went to the app folder in android mode right-clicked it and entered 'open module settings'.In the 'default config' I set the minSDK to the versions I have installed
Got the same problem just fix it by migrating the project to androidx
Click on the Refactor tab->Migrate to androidx->Just give a backup directory->click again Refactor
Hope this will clear the same
It's really strange, I created a new empty project and then I changed in file settings compileSdkVersion from 27.1 Oreo to android-P, then I refactored app to AndroidX and it's working fine if I run it on emulator or via adb connect with my device. But when I try to build apk and install it on my phone here's problem appear - 'App not installed'. But before I changed compileSdkVersion apk installs fine.
Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ru.scapegoats.myapplicationmmmm">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".main"
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>
Gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 'android-P'
defaultConfig {
applicationId "ru.scapegoats.myapplication"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-alpha3'
implementation 'com.google.android.material:material:1.0.0-alpha3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
}
You cannot install app with compileSdkVersion 'android-P' preview version on older OS.
Since beta release for Android P is out, change compileSdkVersion to 28:
compileSdkVersion 28
Note: Ensure you have internet connection so that proper SDK updates can be downloaded.
My Android mobile app is successfully installing only on android version 6.0.1 but I want to install it on android version 4.4.4. What changes I have to do?
Here in my Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.pervaizahmed.ilmileaveapplication">
<uses-sdk android:maxSdkVersion="27" />
<uses-permission android:name="android.permission.SEND_SMS" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat">
<activity android:name=".welcomeScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity" />
</application>
</manifest>
Here is Gradle Code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.pervaizahmed.ilmileaveapplication"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
buildToolsVersion '26.0.2'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:design:26.0.2'
implementation 'com.android.support:support-v4:26.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Problem solved just by removing this line.
androidTestImplementation 'com.android.support.