Error while adding safeargs in Navigation - android

I was trying to add safeargs to my fragments. I was following this codelab : Navigation Codelab. However, when I use the following line :
val safeArgs = FlowStepFragmentArgs by navArgs()
I get a compiler error :
Classifier 'FlowStepFragmentArgs' does not have a companion object, and thus must be initialized here
Here is my main gradle file :
buildscript {
ext {
version_kotlin = "1.3.41"
version_core = "1.1.0"
version_constraint_layout = "1.1.3"
version_lifecycle_extensions = "2.0.0"
version_material = "1.0.0"
version_navigation = "2.1.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$version_kotlin"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$version_navigation"
// 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
}
and my app gradle file :
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'androidx.navigation.safeargs'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
dataBinding {
enabled = true
}
defaultConfig {
applicationId 'com.example.android.navigation'
minSdkVersion 19
targetSdkVersion 29
vectorDrawables.useSupportLibrary = true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$version_kotlin"
implementation "androidx.constraintlayout:constraintlayout:$version_constraint_layout"
implementation "androidx.core:core:$version_core"
implementation "com.google.android.material:material:$version_material"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//Navigation
implementation "androidx.navigation:navigation-fragment-ktx:$rootProject.version_navigation"
implementation "androidx.navigation:navigation-ui-ktx:$rootProject.version_navigation"
}
My navigation.xml is :
<?xml version="1.0" encoding="utf-8"?>
<navigation 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"
app:startDestination="#+id/home_dest">
<fragment
android:id="#+id/home_dest"
android:name="com.example.android.codelabs.navigation.HomeFragment"
android:label="#string/home"
tools:layout="#layout/home_fragment">
<action
android:id="#+id/next_action"
app:destination="#+id/flow_step_one_dest">
</action>
</fragment>
<fragment
android:id="#+id/flow_step_one_dest"
android:name="com.example.android.codelabs.navigation.FlowStepFragment"
tools:layout="#layout/flow_step_one_fragment">
<argument
android:name="flowStepNumber"
app:argType="integer"
android:defaultValue="1"/>
<action
android:id="#+id/next_action"
app:destination="#+id/flow_step_two_dest">
</action>
</fragment>
<fragment
android:id="#+id/flow_step_two_dest"
android:name="com.example.android.codelabs.navigation.FlowStepFragment"
tools:layout="#layout/flow_step_two_fragment">
<argument
android:name="flowStepNumber"
app:argType="integer"
android:defaultValue="2"/>
<action
android:id="#+id/next_action"
app:popUpTo="#id/home_dest">
</action>
</fragment>
<fragment>
<android:id="#+id/settings_dest">
<android:name="com.example.android.codelabs.navigation.SettingsFragment">
<android:label="#string/settings">
<tools:layout="#layout/settings_fragment" />
</fragment>
</navigation>
I have cleaned the project multiple times, but to no effect. Can anyone please point out the mistake that I am making here?

I think there are mistake in your navigation.xml file:
You have this action in home_dest fragment:
<action>
<android:id="#+id/next_action">
<app:destination="#+id/flow_step_one_dest">
</action>
But id and destination are arguments for action. Change it by this way and try again:
<action
android:id="#+id/next_action"
app:destination="#+id/flow_step_one_dest">
</action>

Related

One Signal Google Play Services Library Error React-Native

I recently came across a problem with my app.
I had installed OneSignal, it worked. And some updates after adding the onesignal, stopped working. I don't know exactly what I did wrong or which module is conflicting with the onesignal, I've been on this problem for days and I still can't solve it. Need help.
My package.json:
{
"name": "smartial",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"android-linux": "npx react-native run-android --terminal \"$PWD/shkonsole\""
},
"dependencies": {
"#react-native-community/google-signin": "^4.0.3",
"react-native-onesignal": "^3.7.3",
"#sentry/react-native": "^1.4.1",
"react-native-code-push": "^6.2.1",
"react-native-google-places": "^3.1.2",
"#react-native-community/datetimepicker": "^2.4.2",
"#react-native-community/masked-view": "^0.1.10",
"#react-navigation/material-bottom-tabs": "^5.2.12",
"#react-navigation/native": "^5.4.3",
"#react-navigation/stack": "^5.4.0",
"react-native-gesture-handler": "^1.6.1",
"native-base": "^2.13.12",
"react-native-paper": "^3.10.1",
"react-native-safe-area-context": "^2.0.3",
"react-native-reanimated": "^1.9.0",
"react-native-screens": "^2.8.0",
"apisauce": "^1.1.1",
"react-native-config": "^1.2.1",
"react-native-easy-app": "^1.7.3",
"react-native-vector-icons": "^6.6.0",
"#thallyssonklein/border-layout-react-native": "^1.0.14",
"recoil": "github:eveningkid/Recoil#react-native",
"react": "16.13.1",
"react-native": "0.63.2"
},
"devDependencies": {
"#babel/core": "^7.10.0",
"#babel/runtime": "^7.10.0",
"#bam.tech/react-native-make": "^3.0.0",
"#react-native-community/eslint-config": "^1.1.0",
"babel-jest": "^26.0.1",
"eslint": "^7.1.0",
"jest": "^26.0.1",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}
My android/build.gradle:
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
googlePlayServicesAuthVersion = "16.0.1"
}
repositories {
google()
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:3.6.3')
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 {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
My android/app/build.gradle:
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.smartial"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 24
versionName "3.0.9"
multiDexEnabled true
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
storeFile file('smartial-app.jks')
storePassword KEYSTORE_PASSWORD
keyAlias KEY_ALIAS
keyPassword KEY_PASSWORD
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
packagingOptions {
pickFirst "lib/armeabi-v7a/libc++_shared.so"
pickFirst "lib/arm64-v8a/libc++_shared.so"
pickFirst "lib/x86/libc++_shared.so"
pickFirst "lib/x86_64/libc++_shared.so"
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
// implementation 'com.google.android.gms:play-services-auth:18.0.0'
// implementation "com.google.android.gms:play-services-base:16.0.1"
// implementation "com.google.firebase:firebase-core:16.0.6"
// implementation "com.google.firebase:firebase-messaging:17.3.4"
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
compile 'com.android.support:multidex:1.0.1' //enter the latest version
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
implementation project(':react-native-config')
compile project(':react-native-onesignal') // I just added this line
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply from: file("../../node_modules/#react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
apply plugin: 'com.google.gms.google-services' // <--- this should be the last line
My src/main/AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.smartial">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<application
android:name=".MainApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:allowBackup="false"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
My src/debug/AndroidManifest.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">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
</manifest>
Some observations:
I checked the onesignal setup and followed all the steps again, nothing changed.
I checked all the issues of this error, questions in the stackoverflow, I tried all the small solutions I could, nothing changed.
I tried to remove the device directly on the onesignal panel and nothing changed.
I ran both an avd and a real device, nothing has changed.
I'm always running on debug, not on release.
I changed the app_id of the onesignal in the app to a new one and it worked.

Could not find fragment.jar (androidx.fragment:fragment:1.0.0)

When I try to compile the project I get this error:
Could not find fragment.jar (androidx.fragment:fragment:1.0.0).
what is the problem?
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.example.apps"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// externalNativeBuild {
// cmake {
// cppFlags ""
// }
// }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// externalNativeBuild {
// cmake {
// path "src/main/cpp/CMakeLists.txt"
// version "3.10.2"
// }
// }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.annotation:annotation:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'android.arch.persistence.room:runtime:1.1.1'
annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
kapt "android.arch.persistence.room:compiler:1.1.1"
implementation 'com.google.android.material:material:1.2.0-alpha04'
implementation 'com.google.dagger:dagger-android:2.17'
implementation 'com.google.dagger:dagger-android-support:2.17'
kapt 'com.google.dagger:dagger-android-processor:2.17'
/* Dagger2 - default dependency */
kapt 'com.google.dagger:dagger-compiler:2.17'
}
build errors:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kaptGenerateStubsDebugKotlin'.
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:38)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:kapt'.
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:1195)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$2100(DefaultConfiguration.java:138)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:1170)
at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:72)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.iterator(DefaultConfiguration.java:467)
at org.gradle.api.internal.file.CompositeFileCollection.iterator(CompositeFileCollection.java:64)
at org.jetbrains.kotlin.gradle.internal.SubpluginUtilsKt$withWrappedKaptOptions$1.apply(subpluginUtils.kt:100)
at org.jetbrains.kotlin.gradle.internal.SubpluginUtilsKt$withWrappedKaptOptions$1.apply(subpluginUtils.kt)
at java.util.HashMap.compute(HashMap.java:1197)
at org.jetbrains.kotlin.gradle.internal.SubpluginUtilsKt.withWrappedKaptOptions(subpluginUtils.kt:56)
at org.jetbrains.kotlin.gradle.internal.SubpluginUtilsKt.withWrappedKaptOptions$default(subpluginUtils.kt:51)
at org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask.setupCompilerArgs(KaptGenerateStubsTask.kt:85)
at org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask.setupCompilerArgs(KaptGenerateStubsTask.kt:36)
at org.jetbrains.kotlin.gradle.internal.CompilerArgumentAware$DefaultImpls.setupCompilerArgs$default(CompilerArgumentAware.kt:40)
at org.jetbrains.kotlin.gradle.internal.CompilerArgumentAwareKt.prepareCompilerArguments(CompilerArgumentAware.kt:44)
at org.jetbrains.kotlin.gradle.internal.CompilerArgumentAwareKt.prepareCompilerArguments$default(CompilerArgumentAware.kt:43)
at org.jetbrains.kotlin.gradle.internal.CompilerArgumentAware$DefaultImpls.getFilteredArgumentsMap(CompilerArgumentAware.kt:37)
at org.jetbrains.kotlin.gradle.internal.CompilerArgumentAwareWithInput$DefaultImpls.getFilteredArgumentsMap(CompilerArgumentAware.kt:61)
at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompileTool.getFilteredArgumentsMap(Tasks.kt:52)
at org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask_Decorated.getFilteredArgumentsMap(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.api.internal.tasks.properties.bean.AbstractNestedRuntimeBeanNode$BeanPropertyValue$1$1.create(AbstractNestedRuntimeBeanNode.java:75)
at org.gradle.util.SingleMessageLogger.whileDisabled(SingleMessageLogger.java:341)
at org.gradle.api.internal.tasks.properties.bean.AbstractNestedRuntimeBeanNode$BeanPropertyValue$1.get(AbstractNestedRuntimeBeanNode.java:72)
at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:167)
at org.gradle.api.internal.tasks.properties.bean.AbstractNestedRuntimeBeanNode$BeanPropertyValue.call(AbstractNestedRuntimeBeanNode.java:119)
at org.gradle.api.internal.tasks.properties.AbstractValidatingProperty.validate(AbstractValidatingProperty.java:37)
at org.gradle.api.internal.tasks.properties.DefaultTaskProperties.validate(DefaultTaskProperties.java:184)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
... 27 more
Caused by: org.gradle.internal.resolve.ArtifactNotFoundException: Could not find fragment.jar (androidx.fragment:fragment:1.0.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/fragment/fragment/1.0.0/fragment-1.0.0.jar
at org.gradle.internal.resolve.result.DefaultBuildableArtifactResolveResult.notFound(DefaultBuildableArtifactResolveResult.java:27)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$LocateInCacheRepositoryAccess.resolveArtifactFromCache(CachingModuleComponentRepository.java:335)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$LocateInCacheRepositoryAccess.resolveArtifact(CachingModuleComponentRepository.java:290)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.lambda$resolveArtifact$15(ErrorHandlingModuleComponentRepository.java:185)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.tryResolveAndMaybeBlacklist(ErrorHandlingModuleComponentRepository.java:241)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.performOperationWithRetries(ErrorHandlingModuleComponentRepository.java:207)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.resolveArtifact(ErrorHandlingModuleComponentRepository.java:183)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainArtifactResolver.resolveArtifact(RepositoryChainArtifactResolver.java:98)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DefaultArtifactSet$LazyArtifactSource.create(DefaultArtifactSet.java:183)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DefaultArtifactSet$LazyArtifactSource.create(DefaultArtifactSet.java:170)
at org.gradle.api.internal.artifacts.DefaultResolvedArtifact.getFile(DefaultResolvedArtifact.java:173)
at org.gradle.api.internal.artifacts.transform.TransformationNode$InitialTransformationNode$1.transform(TransformationNode.java:150)
at org.gradle.api.internal.artifacts.transform.TransformationNode$ArtifactTransformationStepBuildOperation.call(TransformationNode.java:229)
at org.gradle.api.internal.artifacts.transform.TransformationNode$ArtifactTransformationStepBuildOperation.call(TransformationNode.java:212)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.api.internal.artifacts.transform.TransformationNode$InitialTransformationNode.execute(TransformationNode.java:145)
at org.gradle.api.internal.artifacts.transform.TransformationNodeExecutor.execute(TransformationNodeExecutor.java:37)
... 15 more
// 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:4.0.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
its probably too late but just replace google() with
maven {
url 'https://maven.google.com/'
name 'Google'
}
in your project level gradle file
I have copied your Gradle update the buildToolsVersion to "29.0.3" and check with my environment. It is working fine and build successfully.
your Gradle file should look like
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.daggerdemo"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// externalNativeBuild {
// cmake {
// cppFlags ""
// }
// }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// externalNativeBuild {
// cmake {
// path "src/main/cpp/CMakeLists.txt"
// version "3.10.2"
// }
// }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.annotation:annotation:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'android.arch.persistence.room:runtime:1.1.1'
annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
kapt "android.arch.persistence.room:compiler:1.1.1"
implementation 'com.google.android.material:material:1.2.0-alpha04'
implementation 'com.google.dagger:dagger-android:2.17'
implementation 'com.google.dagger:dagger-android-support:2.17'
kapt 'com.google.dagger:dagger-android-processor:2.17'
/* Dagger2 - default dependency */
kapt 'com.google.dagger:dagger-compiler:2.17'
}
and make sure your project-level Gradle works file and SDK components are updated.
here is my project level Gradle file:
buildscript {
ext.kotlin_version = '1.3.61'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

How to fix instant app with Android Studio 3.3

I updated to Android Studio 3.3. and also, all SDKs too. Now I cannot run the instant version of my app. I get the following error:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':Words:Words:writeAndroidDebugFeatureApplicationId'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.accept(ExecuteActionsTaskExecuter.java:121)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.accept(ExecuteActionsTaskExecuter.java:117)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:184)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ResolveIncrementalChangesTaskExecuter.execute(ResolveIncrementalChangesTaskExecuter.java:84)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:74)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:109)
at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:93)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:45)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:94)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:63)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:46)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Expected configuration ':Words:Words:androidDebugFeatureMetadataValues' to contain exactly one file, however, it contains no files.
at org.gradle.api.internal.file.AbstractFileCollection.getSingleFile(AbstractFileCollection.java:61)
at com.android.build.gradle.internal.tasks.ApplicationIdWriterTask.fullTaskAction(ApplicationIdWriterTask.kt:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:48)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:705)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:672)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$4.run(ExecuteActionsTaskExecuter.java:338)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:327)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:312)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:75)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:158)
at org.gradle.internal.execution.impl.steps.ExecuteStep.execute(ExecuteStep.java:46)
at org.gradle.internal.execution.impl.steps.CancelExecutionStep.execute(CancelExecutionStep.java:34)
at org.gradle.internal.execution.impl.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:69)
at org.gradle.internal.execution.impl.steps.TimeoutStep.execute(TimeoutStep.java:49)
at org.gradle.internal.execution.impl.steps.CatchExceptionStep.execute(CatchExceptionStep.java:34)
at org.gradle.internal.execution.impl.steps.CreateOutputsStep.execute(CreateOutputsStep.java:49)
at org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:42)
at org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:28)
at org.gradle.internal.execution.impl.steps.CacheStep.executeWithoutCache(CacheStep.java:133)
at org.gradle.internal.execution.impl.steps.CacheStep.lambda$execute$5(CacheStep.java:83)
at org.gradle.internal.execution.impl.steps.CacheStep$$Lambda$483/988154824.get(Unknown Source)
at java.util.Optional.orElseGet(Optional.java:267)
at org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:82)
at org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:37)
at org.gradle.internal.execution.impl.steps.PrepareCachingStep.execute(PrepareCachingStep.java:33)
at org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:38)
at org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:23)
at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:95)
at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:88)
at org.gradle.internal.execution.impl.steps.SkipUpToDateStep$$Lambda$416/111798206.apply(Unknown Source)
at java.util.Optional.map(Optional.java:215)
at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:52)
at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:36)
at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:34)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:109)
... 40 more
gradle-wrapper.properties
#Tue Jan 15 12:44:45 CET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2-all.zip
It works with the old Android Studio Gradle-4.6 but when I try to roll back I get the message : ERROR: Minimum supported Gradle version is 4.10.1. Current version is 4.6.
dependencies
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.ads.consent:consent-library:1.0.7'
implementation 'com.google.android.gms:play-services-games:16.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-ads:17.1.3'
api 'com.android.billingclient:billing:1.1';
// Required by Facebook network
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.facebook.android:audience-network-sdk:5.1.0'
implementation 'com.google.ads.mediation:facebook:5.1.0.0'
implementation "com.google.android.instantapps:instantapps:1.0.0"
settings.gradle
include ':ASCore'
include ":Words:Words"
include ":Words:WordsInstant"
include ':Words:WordsInstall'
top-level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules .
buildscript {
ext {
/* Build versions */
minSdkVersion = 16
targetSdkVersion = 28
compileSdkVersion = 28
buildToolsVersion = "28.0.3"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
base module build.gradle
apply from: '../../feature.gradle'
apply from: '../version.gradle'
android {
defaultConfig {
// Feature Version = Instant ap version
versionCode VERSION_CODE
versionName VERSION_NAME
resValue "string", "app_id", "XXXXX"
manifestPlaceholders.appClass = APPLICATION_ID + ".App"
}
}
apply plugin: 'com.google.gms.google-services'
instant module build.gradle
apply plugin: 'com.android.instantapp'
apply from: '../version.gradle'
android {
defaultConfig {
applicationId APPLICATION_ID
manifestPlaceholders.appClass = APPLICATION_ID + ".App"
setProperty("archivesBaseName", "$APPLICATION_ID-$VERSION_CODE")
}
}
dependencies {
implementation project(':Words:Words')
}
app.gradle
apply plugin: 'com.android.application'
android {
buildToolsVersion rootProject.ext.buildToolsVersion
lintOptions {
disable 'MissingTranslation'
}
flavorDimensions "type"
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
//multiDexEnabled true // enable for the MediationTestSuite
resValue "string", "AS_BUILD_TIMESTAMP", "\"" + System.currentTimeMillis() + "\""
}
signingConfigs {
AsgardKey {
keyAlias 'XXX'
keyPassword 'XXX'
storeFile file("XXX")
storePassword 'XXX'
v2SigningEnabled true
}
AsgardKeyDev {
keyAlias 'XXX'
keyPassword 'XXX'
storeFile file("XXX")
storePassword 'XXX'
v2SigningEnabled true
}
}
buildTypes {
debug {
resValue "bool", "IS_DEBUG", "true"
signingConfig XXX
}
release {
resValue "bool", "IS_DEBUG", "false"
minifyEnabled true
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), "$rootProject.projectDir/proguard-rules.pro"
signingConfig XXX
}
}
productFlavors {
play {
dimension 'type'
buildConfigField 'boolean', 'IS_PRO', 'false'
}
}
bundle {
density.enableSplit = true
abi.enableSplit = true
language {
enableSplit = true
}
}
applicationVariants.all { variant ->
if (variant.buildType.name.equals("release")) {
variant.outputs.all { output ->
outputFileName = "${applicationId}-${versionCode}-${variant.flavorName}.apk"
}
}
if (variant.getBuildType().isMinifyEnabled()) {
variant.assemble.doLast {
copy {
from variant.mappingFile
into variant.outputs[0].outputFile.parent
rename { String fileName ->
"${applicationId}-${versionCode}-${variant.flavorName}-mapping.txt"
}
}
}
}
}
}
dependencies {
implementation project(':ASCore')
}
apply from: "$rootProject.projectDir/dependencies.gradle"
feature.gradle
apply plugin: 'com.android.feature'
android {
buildToolsVersion rootProject.ext.buildToolsVersion
baseFeature true
lintOptions {
disable 'MissingTranslation'
}
flavorDimensions "default"
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
resValue "string", "AS_BUILD_TIMESTAMP", "\"" + System.currentTimeMillis() + "\""
}
signingConfigs {
AsgardKey {
keyAlias 'XXXX'
keyPassword 'XXXX'
storeFile file("XXXX")
storePassword 'XXXX'
v2SigningEnabled true
}
AsgardKeyDev {
keyAlias 'XXXX'
keyPassword 'XXXX'
storeFile file("XXXX")
storePassword 'XXXX'
v2SigningEnabled true
}
}
buildTypes {
debug {
resValue "bool", "IS_DEBUG", "true"
signingConfig XXXX
}
release {
resValue "bool", "IS_DEBUG", "false"
minifyEnabled false
debuggable false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), "$rootProject.projectDir/proguard-rules.pro"
signingConfig XXXX
}
}
productFlavors {
android {
buildConfigField 'boolean', 'IS_PRO', 'false'
}
}
bundle {
density.enableSplit = true
abi.enableSplit = true
language {
enableSplit = true
}
}
}
dependencies {
implementation project(':ASCore')
}
apply from: "$rootProject.projectDir/dependencies.gradle"
How I can fix this issue?
Regards
Ronald
My current working solution
Remove apply plugin: 'com.google.gms.google-services' from my base module. In the old version was this necessary to get firebase analytics working.
Now I use the aab package format with instant app support:
https://developer.android.com/topic/google-play-instant/getting-started/instant-enabled-app-bundle
and modify my AndroidManifest.xml
<manifest ... xmlns:dist="http://schemas.android.com/apk/distribution">
<dist:module dist:instant="true" />
...
</manifest>
Android Studio show the warning
The option setting 'android.injected.deploy.instant-app=true' is
experimental and unsupported.
but it works with Google Play Store, Play Services and Firebase :-)
Regards
Ronald

BottombarNavigationView is not working in kitkat

<android.support.design.widget.BottomNavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
design:menu="#menu/bottom_menu_bar" />
app level gradle.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
useLibrary 'org.apache.http.legacy'
/*splits {
abi {
enable true
reset()
include 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips'
universalApk false
}
}*/
defaultConfig {
applicationId "user.com.hlthee"
minSdkVersion 17
targetSdkVersion 25
versionCode 2
versionName "1.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
assets.srcDirs = ['src/main/assets', 'src/main/assets/']
res.srcDirs = ['src/main/res', 'src/main/assets/fonts']
}
}
dexOptions {
jumboMode true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/ECLIPSE_.SF'
exclude 'META-INF/ECLIPSE_.RSA'
}
}
Theme
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:background">#color/primary_background</item>
<item name="background">#color/primary_background</item>
<item name="android:colorPrimaryDark">#color/primary_background</item>
<item name="colorPrimaryDark">#color/primary_background</item>
<item name="android:navigationBarColor">#color/primary_background</item>
<item name="android:alertDialogTheme">#style/myDialog</item>
<item name="android:datePickerDialogTheme">#style/myDatePickertheme</item>
<item name="android:itemTextAppearance">#style/itemTextStyle.AppTheme</item>
<item name="itemTextAppearance">#style/itemTextStyle.AppTheme</item>
</style>
It is working perfectly fine in api level greater or equal to 21 but it is not working in kitkat. I have even try with the other library but the output is same. I am exactly getting what is the problem with my code.

Android studio doesn't find theme with custom gradle configuration for testing

Im trying to do tests in my android application. I have this build.gradle for the root:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
configure(allprojects) { project ->
buildscript {
repositories {
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
mavenLocal()
}
}
}
project.ext.preDexLibs = !project.hasProperty('disablePreDex')
subprojects {
group = 'com.firext.android'
ext.androidBuildToolsVersion = '19.1.0';
ext.androidMinSdkVersion = 18;
ext.androidCompileSdkVersion = 19;
ext.androidTargetSdkVersion = 19;
repositories {
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url "file://${System.getenv("ANDROID_HOME")}/extras/android/m2repository" }
mavenLocal()
}
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
} else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
}
}
}
apply plugin: 'java'
And this for the build.gradle project module:
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libraries:AndroidBootstrap')
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.android.gms:play-services:3.1.+'
compile 'com.github.pedrovgs:renderers:1.0.9'
compile 'com.jakewharton:butterknife:5.0.1'
compile 'com.etsy.android.grid:library:1.0.4'
compile 'ch.acra:acra:4.5.0'
compile 'com.loopj.android:android-async-http:1.4.4'
compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
compile 'com.android.support:support-v4:+'
androidTestCompile 'com.google.guava:guava:14.0.1',
'com.squareup.dagger:dagger:1.1.0',
'org.hamcrest:hamcrest-integration:1.1',
'org.hamcrest:hamcrest-core:1.1',
'org.hamcrest:hamcrest-library:1.1',
'com.jakewharton.espresso:espresso:1.1-r2'
}
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
signingConfigs {
release {
//Omitted
}
debug {
testCoverageEnabled = true
}
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs += 'src/gen'
res.srcDirs = ['res']
}
test {
java.srcDir file('src/test/java')
resources.srcDir file('src/test/resources')
}
androidTest.setRoot('.')
androidTest {
java { srcDirs = [
'src/test/java'
] }
res.srcDirs = ['res']
assets.srcDirs = [
'assets'
]
resources.srcDirs = [
'src'
]
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
productFlavors {}
}
This in the manifest:
<application
android:allowBackup="false"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/FirextTheme"
android:name=".FirextApplication">
And this in the styles:
<resources>
<style name="CustomDialog" parent="android:Theme.Holo.Light.Dialog">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowIsFloating">false</item>
</style>
<style name="FirextTheme" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/ActionBar</item>
</style>
<style name="ActionBar" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#D30000</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#ffffff</item>
<item name="android:displayOptions">useLogo|showHome</item>
</style>
</resources>
And when i do a sync i get this error:
Error:(29, 24) No resource found that matches the given name (at 'theme' with value '#style/FirextTheme').
Before of this i had a default build.gradle and worked ok, but now dont..Whats wrong?
You should have add defaultConfig to android section:
android {
compileSdkVersion ext.androidCompileSdkVersion
buildToolsVersion ext.androidBuildToolsVersion
defaultConfig {
minSdkVersion ext.androidMinSdkVersion
targetSdkVersion ext.androidTargetSdkVersion
}
}
The Holo is available only from 4.0. If you need to support older versions you have to use AppCompat or ActionBarSherlock
Can you change your style.xml to:
<style name="FirextTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/ActionBar</item>
</style>

Categories

Resources