Android Manifest Default Activity not found - java

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
package="com.gmail.mansur.project">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.Manifest.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<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_CACHE_FILESYSTEM"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.UNINSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/mylogo"
android:supportsRtl="true"
android:theme="#style/AppTheme.NoActionBar"
tools:ignore="GoogleAppIndexingWarning"
>
<activity
android:name=".FirstActivity"
android:isScrollContainer="true"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/Mansur"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:hardwareAccelerated="true"
android:isScrollContainer="true"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/Mansur"
android:windowSoftInputMode="adjustPan">
</activity>
<activity
android:name=".StartActivity"
android:label="Bilgi Teknolojileri"
android:logo="#mipmap/mylogo"
android:screenOrientation="portrait"
android:theme="#style/AppTheme"
android:windowSoftInputMode="adjustPan"
tools:ignore="ExtraText" />
<service
android:name="com.example.myapplicationservices.MyApplicationService"
android:enabled="true"
android:exported="false" />
<!--android:stopWithTask="false"-->
</application>
</manifest>
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
release = [
versionName: "6.1.1",
versionCode: 6101
]
setup = [
compileSdk: 28,
buildTools: "28.0.3",
minSdk : 14,
targetSdk : 28
]
versions = [
androidX: '1.0.0',
constraintLayout: '1.1.3'
]
}
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
// classpath 'com.android.tools.build:gradle:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven {
url "https://maven.google.com"
}
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
multiDexEnabled true
applicationId "com.gmail.mansur.project"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName '1.1'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// setProperty("archivesBaseName", "MaterialDrawer-v$versionName-c$versionCode")
}
buildTypes {
// debug {
// applicationIdSuffix ".debug"
// versionNameSuffix "-DEBUG"
// try {
// signingConfig signingConfigs.debug
// } catch (ex) {
// }
// minifyEnabled false
// }
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/android.support.design_material.version'
exclude 'META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version'
exclude 'META-INF/androidx.transition_transition.version'
exclude 'META-INF/androidx.appcompat_appcompat.version'
exclude 'META-INF/androidx.swiperefreshlayout_swiperefreshlayout.version'
exclude 'META-INF/androidx.cursoradapter_cursoradapter.version'
exclude 'META-INF/androidx.drawerlayout_drawerlayout.version'
exclude 'META-INF/androidx.print_print.version'
exclude 'META-INF/androidx.versionedparcelable_versionedparcelable.version'
exclude 'META-INF/androidx.interpolator_interpolator.version'
exclude 'META-INF/androidx.fragment_fragment.version'
exclude 'META-INF/androidx.customview_customview.version'
exclude 'META-INF/androidx.documentfile_documentfile.version'
exclude 'META-INF/androidx.legacy_legacy-support-core-utils.version'
exclude 'META-INF/androidx.vectordrawable_vectordrawable.version'
exclude 'META-INF/androidx.loader_loader.version'
exclude 'META-INF/androidx.viewpager_viewpager.version'
exclude 'META-INF/androidx.asynclayoutinflater_asynclayoutinflater.version'
exclude 'META-INF/androidx.recyclerview_recyclerview.version'
exclude 'META-INF/androidx.core_core.version'
exclude 'META-INF/proguard/androidx-annotations.pro'
exclude 'META-INF/androidx.vectordrawable_vectordrawable-animated.version'
exclude 'META-INF/androidx.slidingpanelayout_slidingpanelayout.version'
exclude 'META-INF/androidx.cardview_cardview.version'
exclude 'META-INF/androidx.coordinatorlayout_coordinatorlayout.version'
exclude 'META-INF/androidx.legacy_legacy-support-core-ui.version'
exclude 'META-INF/com.google.android.material_material.version'
}
repositories {
maven { url 'https://jitpack.io' }
maven { url "http://clojars.org/repo" }
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
buildToolsVersion '28.0.3'
productFlavors {
}
// lintOptions {
// abortOnError false
// }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// implementation 'com.android.support:appcompat-v7:28.0.0'
// implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
// implementation 'com.android.support:design:28.0.0-alpha1'
// implementation 'com.android.support:design:28.0.0'
// implementation 'com.android.support:support-v4:28.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation project(':myapplicationwebapi')
implementation project(':myapplicationservices')
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.github.leinardi:FloatingActionButtonSpeedDial:master-SNAPSHOT'
implementation 'com.kaopiz:kprogresshud:1.2.0'
implementation 'com.yarolegovich:lovely-dialog:1.1.0'
implementation 'com.muddzdev:styleabletoast:2.1.2'
implementation 'com.annimon:stream:1.2.1'
implementation project(':recyclerrefreshlayout')
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support.test:runner:1.0.2'
implementation 'com.mikepenz:materialdrawer:6.1.1'
implementation 'com.google.android.material:material:1.0.0'
implementation "com.google.android.material:material:${versions.androidX}"
implementation "androidx.appcompat:appcompat:${versions.androidX}"
implementation "androidx.recyclerview:recyclerview:${versions.androidX}"
implementation "androidx.cardview:cardview:${versions.androidX}"
implementation "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}"
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.bumptech.glide:glide:3.8.0'
// the sample uses more advanced functions of the fastadapter
// https://github.com/mikepenz/FastAdapter/
implementation 'com.mikepenz:fastadapter-commons:3.3.0'
// used to generate the Open Source section
// https://github.com/mikepenz/AboutLibraries
implementation 'com.mikepenz:aboutlibraries:6.2.0'
//used to provide different itemAnimators for the RecyclerView
//https://github.com/mikepenz/ItemAnimators
implementation 'com.mikepenz:itemanimators:1.1.0'
// used to provide the MiniDrawer to normal Drawer crossfade effect via a SlidingPane layout
// --> https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/MiniDrawerActivity.java
// https://github.com/mikepenz/Crossfader
implementation 'com.mikepenz:crossfader:1.6.0'
// used to provide the two step crossfade DrawerLayout. Which allows to have a mini layout which transforms to a normal layout within the drawer
// --> https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CrossfadeDrawerLayoutActvitiy.java
// https://github.com/mikepenz/CrossfadeDrawerLayout
implementation('com.mikepenz:crossfadedrawerlayout:1.1.0')
implementation 'com.mikepenz:google-material-typeface:3.0.1.3.original#aar'
implementation 'com.mikepenz:fontawesome-typeface:5.3.1.1#aar'
implementation 'com.mikepenz:octicons-typeface:3.2.0.5#aar'
//font
implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.5#aar'
implementation 'com.mikepenz:meteocons-typeface:1.1.0.5#aar'
implementation 'com.mikepenz:community-material-typeface:2.7.94.1#aar'
implementation 'com.mikepenz:weather-icons-typeface:2.0.10.5#aar'
implementation 'com.mikepenz:typeicons-typeface:2.0.7.5#aar'
implementation 'com.mikepenz:entypo-typeface:1.0.0.5#aar'
implementation 'com.mikepenz:devicon-typeface:2.0.0.5#aar'
implementation 'com.mikepenz:foundation-icons-typeface:3.0.0.5#aar'
implementation 'com.mikepenz:ionicons-typeface:2.0.1.5#aar'
implementation 'com.mikepenz:pixeden-7-stroke-typeface:1.2.0.3#aar'
implementation 'com.nikhilpanju.recyclerviewenhanced:recyclerviewenhanced:1.1.0'
// implementation 'org.jetbrains:annotations:15.0'
}
configurations.all {
resolutionStrategy.force "com.mikepenz:iconics-core:3.1.0"
resolutionStrategy.force "com.mikepenz:fastadapter:3.3.0"
resolutionStrategy.force "com.android.support:support-v4:${versions.androidX}"
resolutionStrategy.force "com.android.support:appcompat-v7:${versions.androidX}"
resolutionStrategy.force "com.android.support:cardview-v7:${versions.androidX}"
resolutionStrategy.force "com.android.support:recyclerview-v7:${versions.androidX}"
resolutionStrategy.force "com.android.support:design:${versions.androidX}"
resolutionStrategy.force "com.android.support:support-annotations:${versions.androidX}"
}
I have tried:
1-İnvalidate Caches / Restart
2-Check Filter intent
3-Manifest delete after created
4-Clean Project/Rebuild Project
I couldn't find the solution to the problem , i did sync gradle but not improved. Also added in manifest "" didn't work again :)
Help me thank you :)
enter image description here

You could move
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
to another activity, and click File -> Invalidate Caches / Restart..., then clicking on Invalidate and Restart.

Related

java.io.IOException: null InputStream when changing higher SDK version in android studio

I am very new to android and java development.
I am trying to devlop an app and integrate one SDK from Emarsys.. This SDK requires the app to use higher sdk version.
But after changing the SDK version to the higher version (33), I have an error and the app is always being terminated immediately..
DropBoxUtil pid-9840 [AppErrors] null InputStream [CONTEXT service_id=254 ]
java.io.IOException: null InputStream
at boqn.c(:com.google.android.gms#230413037#23.04.13 (150400-505809224):23)
Here is my gradle.bundle
apply plugin: 'com.android.application'
android {
compileSdkVersion 33
defaultConfig {
applicationId "io.ionic.starter"
minSdkVersion 24
targetSdkVersion 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
implementation project(':capacitor-android')
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation project(':capacitor-cordova-android-plugins')
//for emersys
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.5.0'
//Emarsys
implementation 'com.emarsys:emarsys-sdk:3.4.0'
implementation 'com.emarsys:emarsys-firebase:+'
}
apply from: 'capacitor.build.gradle'
try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
gradle in project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath 'com.google.gms:google-services:4.3.13'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply from: "variables.gradle"
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and here is the manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.ionic.starter">
<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:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:name="io.ionic.starter.MainActivity"
android:label="#string/title_activity_main"
android:theme="#style/AppTheme.NoActionBarLaunch"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths"></meta-data>
</provider>
<!-- Emersys-->
<meta-data
android:name="com.emarsys.mobileengage.notification_color"
android:resource="#color/colorPrimary" />
<meta-data
android:name="com.emarsys.mobileengage.small_notification_icon"
android:resource="#drawable/default_small_notification_icon" />
<service
android:name="com.emarsys.service.EmarsysFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<!-- <provider-->
<!-- android:name="com.emarsys.provider.SharedHardwareIdentificationContentProvider"-->
<!-- android:authorities="${applicationId}"-->
<!-- android:enabled="true"-->
<!-- android:exported="true"-->
<!-- android:grantUriPermissions="true" />-->
</application>
<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
I am not sure what causing it, because I haven't even started to integrate the service from SDK..
I fixed this issue by taking lower version of the Emersys SDK :)
In build.gradle (project), update Google Service dependency to
classpath 'com.google.gms:google-services:4.3.15'

Android Studio suddenly can't find ANY drawable components

Like the title suggests, all of a sudden, my Android Studio projects simply can't locate any of my drawable resources that I call when using android:background="#drawable/serving_editor_background" for example, it'll just give me this error code for every single drawable that has been called:
AAPT: error: resource drawable/serving_editor_background (aka com.example.poop123:drawable/serving_editor_background) not found.
Execution failed for task ':app:mergeDebugResources'.
> com.android.build.gradle.tasks.ResourceException (no error message)
ParseError at [row,col]:[2,6]
Message: The processing instruction target matching "[xX][mM][lL]" is not allowed.
It literally does it for every single one (with their respective names and file path), all of the ones that used to work up until now, not a single one works, and I never changed anything in the gradle, but I'll still provide it:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.poop123"
minSdkVersion 23
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.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'com.ismaeldivita.chipnavigation:chip-navigation-bar:1.3.2'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.72'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.github.devlight.navigationtabstrip:navigationtabstrip:+'
implementation 'com.google.firebase:firebase-database:20.0.2'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.wear:wear:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
compileOnly 'com.google.android.wearable:wearable:2.6.0'
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.poop123">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<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.Poop123">
<activity android:name=".EditAddition"></activity>
<activity android:name=".ConfirmAddition" />
<activity android:name=".Goal" />
<activity android:name=".ActivityLevel" />
<activity android:name=".newFoodMenu" />
<activity android:name=".foodLibrary" />
<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'm getting really frustrated at this, because I changed absolutely nothing (just a specific XML code for a certain activity), and now none of the drawables can be found.
If any more info, let me know.
Bascially, I loaded up an old version of the project, copy pasted all the new code into the current project, noticed that on one of the drawable's, I had an extra
<?xml version="1.0" encoding="utf-8"?>
And for some reason it completely clogged up the whole thing, and the exception messages it gave, had 0 to do with it in a sense, had to manually find the problem myself.
First of all locate the drawable folder of your project and see the resources. if you found the resources try android:src="#drawable/resource"

Android Studio can't find resource and resource linking failed

Recently I had problems with AAPT2. The problems were caused by my username that contained non-ascii characters. I created another Windows account(without non-ascii characters) and installed Android Studio on it. Then I opened my older project and when AS asked me to update I agreed to that. Now when I try to build my app I get these errors:
Android resource linking failed
D:\Android_Studio\Praca\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
D:\Android_Studio\Praca\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
D:\Android_Studio\Praca\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2970: error: resource android:attr/fontVariationSettings not found.
D:\Android_Studio\Praca\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2971: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Most of threads I found of StackOverflow suggest that this problem might be related to support library, they say that version of it might be wrong. How could I change the version? My project also uses OpenCV library and configuration of it might be invalid.
What I tried already was cleaning and rebuilding project and adjusting compileSDKVersion in Gradle.
Here is values-v28.xml file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Base.Theme.AppCompat" parent="Base.V28.Theme.AppCompat"/>
<style name="Base.Theme.AppCompat.Light" parent="Base.V28.Theme.AppCompat.Light"/>
<style name="Base.V28.Theme.AppCompat" parent="Base.V26.Theme.AppCompat">
<!-- We can use the platform styles on API 28+ -->
<item name="dialogCornerRadius">?android:attr/dialogCornerRadius</item>
</style>
<style name="Base.V28.Theme.AppCompat.Light" parent="Base.V26.Theme.AppCompat.Light">
<!-- We can use the platform styles on API 28+ -->
<item name="dialogCornerRadius">?android:attr/dialogCornerRadius</item>
</style>
And here is Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.kawa.praca">
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<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=".Powitanie">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Trening" />
<activity android:name=".Zdjecia" />
<provider
android:name=".DbProvider"
android:authorities="com.example.kawa.praca"
android:exported="true" />
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.example.android.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
<activity android:name=".AddActivity" />
<activity android:name=".UserPanel" />
<activity android:name=".ScoringPanel" />
<activity android:name=".Scoring" />
<activity android:name=".NewPlanActivity" />
<receiver
android:name=".PlanReceiver"
android:enabled="true"
android:exported="true" />
<activity android:name=".ChartsActivity"></activity>
</application>
</manifest>
Also below is my build.gradle file app module. In this file in sub-clause 'dependencies' entries with support library are underlined and AS shows me a warning:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:customtabs:26.1.0
I tried changing versions to newer or older but this warning still appears.
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.kawa.praca"
minSdkVersion 24
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'
}
}
sourceSets { main { jni.srcDirs = ['src/main/jni', 'src/main/jniLibs/'] }
}
// Encapsulates your external native build configurations.
externalNativeBuild {
// Encapsulates your CMake build configurations.
cmake {
// Provides a relative path to your CMake build script.
path "../CMakeLists.txt"
}
}
//buildToolsVersion '27.0.3'
buildToolsVersion '28.0.3'
productFlavors {
}
}
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
//implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0-alpha'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:customtabs:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'
implementation project(':openCVLibrary340')
//implementation 'com.jjoe64:graphview:4.2.2'
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:+'
}
I had the same error fixed it by updating the compilesdkversion to 28, since currently my build tools version is 28.0.3 , hence the version should be same as to have a perfect build.
Also check for your implementation 'com.android.support:appcompat-v7:28.0.0'
Change the respective Dependency versions to 28, it will prevent run time crashing

Getting error after adding Firebase to my dependencies "Program already present"

Recently after adding Firebase to my code it says "Program type already present"
full stack:
Error: Program type already present: com.firebase.client.android.AndroidCredentialStore
build.gradle app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.user.candleclub"
minSdkVersion 23
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-database:16.0.6'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.1.0'
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 'com.github.yukuku:ambilwarna:2.0.1'
implementation 'com.android.support:support-annotations:28.0.0'
// implementation 'com.github.kencheung4:android-StickerView:1.0.0'
implementation 'com.github.hotchemi:permissionsdispatcher:3.1.0'
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:3.1.0'
implementation project(':android-StickerView')
implementation 'com.vanniktech:emoji:0.5.1'
implementation 'com.vanniktech:emoji-ios:0.5.1'
implementation 'com.vanniktech:emoji-one:0.5.1'
implementation 'com.vanniktech:emoji-google:0.5.1'
implementation 'com.vanniktech:emoji-twitter:0.5.1'
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.google.firebase:firebase-measurement-connector-impl:17.0.5'
implementation "android.arch.core:runtime:1.1.1"
implementation "android.arch.core:common:1.1.1"
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
}
apply plugin: 'com.google.gms.google-services'
project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
manifest.xml:
<?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.user.candleclub">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<meta-data
tools:replace="android:value"
android:name="android.support.VERSION"
android:value="26.1.0" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".ChooseFrame" />
<activity android:name=".PrintActivity" />
<activity android:name=".MainMenu">
<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>
Tried adding all kinds of dependencies but it didn't fix it. Anyone has an idea?
EDIT: After commenting out all Firebase dependencies there is no error. Does anyone know why? Is there a way to use Firebase's storage without the error?

java.lang.NoClassDefFoundError: com.google.android.gms.R$string

I am having a little trouble with the complier,
Same code I use on Nexus 5, no error.
as Soon as I use it in Tablet, it crash right away and the error said
java.lang.NoClassDefFoundError: com.google.android.gms.R$string
with brunch of unknown source...
and if i remove
multiDexEnabled true
and remove
compile 'org.twitter4j:twitter4j-core:4.0.2'
then it works on both, does anybody know the reason why?
Below is my build.grade
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.package.name"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'org.twitter4j:twitter4j-core:4.0.2'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.isseiaoki:simplecropview:1.0.8'
compile 'com.qozix:tileview:2.0.7'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
}
Blow is the manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package.name" >
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission
android:name="com.google.android.c2dm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<application
android:name=".utility.Apps"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:largeHeap="true"
android:theme="#style/AppTheme" >
<receiver
android:name=".gcm.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</receiver>
<service android:name=".gcm.GcmIntentService" />
<activity android:name=".SplashActivity"
android:theme="#style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and then a lot of activities
I look into my code many time, and I look at each library I am using and I was able to fix it.
First, like #BrainMiz said mutiDexEnabled should set it off. I just comment it instead of set it as false.
defaultConfig {
applicationId "com.package.name"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
//multiDexEnabled true
}
Second, it is the dependencies.
Since I don't have any jar in my libs folder I remove
compile fileTree(dir: 'libs', include: ['*.jar'])
also remove all not being used gms library, only add the one that being used. I have to give some credits to #Radix because I did found some error in my code regarding to the code that where I check if the device has google play store.
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'org.twitter4j:twitter4j-core:4.0.2'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:23.1.1'
//compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.okhttp:okhttp:2.5.0'
//compile 'com.android.support:support-v4:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.isseiaoki:simplecropview:1.0.8'
compile 'com.qozix:tileview:2.0.7'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
}
I believe you should try turning multiDexEnabled false and get rid of the compile 'com.google.android.gms:play-services-gcm:8.4.0' . You have two play-services which forces you to turn multiDexEnabled to true
Change this line
<uses-permission
android:name="com.google.android.c2dm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
with this
<permission android:name="<your-package-name>.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="<your-package-name>.permission.C2D_MESSAGE" />
Also i see a lot of anomaly in your manifest with respect to how you have declared GCM . Have a look at the technical docs.
Got the same problem.. just clean the project, then make it and finally run it
In my case, I changed the theme of my app in the AndroidManifest.xml file and cleared out my styles.xml file (because I'm a noob and hoped to just use an out-of-the-box android theme). After launching the app, I assume there were zombie references to the old theme that caused the error because, after reverting my changes, the error disappeared.
I did remove
compile 'com.android.support:multidex:1.0.1'
and sync project. After added this line and synced again. Next, cleaned project to remove old dex files (may cause problem with dex archives merging), and it helped.
I had the same issue
Had in gradle.build dependencies :
compile 'com.android.support:multidex:1.0.0'
And in AndroidManifest.xml :
<application
...
android:name="android.support.multidex.MultiDexApplication">
Having same issue and was stuck for a whole day. Finally got solution.
Add in your app level gradle.build:
repositories {
jcenter()
}
dependencies {
compile 'com.google.android:multidex:0.1'
}
Then override attachBaseContext in your Application class like below:
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
And don't forgot to enable mutlidex support as below:
android {
...
defaultConfig {
...
multiDexEnabled true
}
}

Categories