I am trying to install the latest release Navigation in Architecture components .
i am following this document Tutorial link
When i am trying to sync it is giving error .
Could not find androidx.navigation:safe-args-gradle-plugin:1.0.0-alpha01.
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/navigation/safe-args-gradle-plugin/1.0.0-alpha01/safe-args-gradle-plugin-1.0.0-alpha01.pom
https://dl.google.com/dl/android/maven2/androidx/navigation/safe-args-gradle-plugin/1.0.0-alpha01/safe-args-gradle-plugin-1.0.0-alpha01.jar
https://jcenter.bintray.com/androidx/navigation/safe-args-gradle-plugin/1.0.0-alpha01/safe-args-gradle-plugin-1.0.0-alpha01.pom
https://jcenter.bintray.com/androidx/navigation/safe-args-gradle-plugin/1.0.0-alpha01/safe-args-gradle-plugin-1.0.0-alpha01.jar
Required by:
project :
Module Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.ard.navigationapp"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.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'
def nav_version = "1.0.0-alpha01"
implementation 'android.arch.navigation:navigation-fragment:$nav_version' // use -ktx for Kotlin
implementation 'android.arch.navigation:navigation-ui:$nav_version' // use -ktx for Kotlin
// optional - Test helpers
androidTestImplementation 'android.arch.navigation:navigation-testing:$nav_version' // use -ktx for Kotlin
}
apply plugin: 'androidx.navigation.safeargs'
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.1.2'
classpath "androidx.navigation:safe-args-gradle-plugin:1.0.0-alph
a01"
// 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
}
That artifact does not seem to exist, based on what's in https://maven.google.com right now. Try android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha01 instead. See also this issue.
Try to add
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha01"
instead of
classpath "androidx.navigation:safe-args-gradle-plugin:1.0.0-alpha01"
If you're not concerned with type-safety of argument, you can skip the Safe args part and you will be good to go with Navigation Component.
Related
i was trying to use AWS amplify facilities with my android app. my gradle is failed to build with an error showing.
this is my app gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
compileSdkVersion 29
defaultConfig {
applicationId "com.example.azuretest"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.2.0-alpha02'
implementation 'com.amplifyframework:core:0.9.0'
implementation 'com.amplifyframework:aws-api:0.9.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
this is my project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.60'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.amplifyframework:amplify-tools-gradle-plugin:0.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply plugin: 'com.amplifyframework.amplifytools'
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this is the error:
F:\AzureTest\amplify-gradle-config.json (The system cannot find the file specified)
Note: I'm totally new on this platform, I'm sorry if I violate the protocols of asking question.
You must have missed a step while you were following creating the app. Refer to Step 3. in the following document:
https://aws-amplify.github.io/docs/android/start
For part a. regarding amplify configure, make sure to run that in your app's root directory. (in your case F:\AzureTest)
Make sure to perform part b. in your Android Studio toolbar as well
I am trying to use firebase with my App and i did all the steps listed in the official website of firebase on how to add the google-service plugin and the firebase products into both my module and project build.gradle , but i still got this list of errors :
ERROR: Gradle DSL method not found: 'implementiation()' Possible
causes:
1-The project 'FriendlyChat' may be using a version of the Android
Gradle plug-in that does not contain the method (e.g. 'testCompile'
was added in 1.1.0).
2-The project 'FriendlyChat' may be using a version of Gradle that
does not contain the method.
3-The build file may be missing a Gradle plugin.
and i referred to the possible solutions here on stackoverflow but i got the same results.
here's my project:buidl.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
// 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
}
here's my app:build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.friendlychat"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementiation 'com.google.firebase:firebase-perf:19.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
api 'com.google.android.material:material:1.1.0-alpha06'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
androidTestImplementation 'androidx.test:core:1.1.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test:runner:1.2.0-alpha05'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha05'
}
It's a typo in your build.gradle. You have used implementiation instead of implementation.
Change this like below:
implementation 'com.google.firebase:firebase-perf:19.0.4'
instead of
implementiation 'com.google.firebase:firebase-perf:19.0.4'
I am developing new app using android architecture components but I am getting the following error from gradle
Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.
- lifecycle-compiler-2.0.0.jar (androidx.lifecycle:lifecycle-compiler:2.0.0)
Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and will be removed in the future.
See https://developer.android.com/r/tools/annotation-processor-error-message.html for
below is my app.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.lifecycleawaredemo"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.lifecycle:lifecycle-compiler:2.0.0'
def lifecyle_version = "1.1.1"
implementation "android.arch.lifecycle:extensions:$lifecyle_version"
implementation "android.arch.lifecycle:compiler:$lifecyle_version"
}
below my build.gradle
buildscript {
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
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 {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
First of all, you appear to be mixing up your androidx lifecycle dependencies. You are using androidx artifacts, so you can drop this part:
def lifecyle_version = "1.1.1"
implementation "android.arch.lifecycle:extensions:$lifecyle_version"
implementation "android.arch.lifecycle:compiler:$lifecyle_version"
You should only need:
implementation 'androidx.lifecycle:lifecycle-compiler:2.0.0'
Now, as to the error, the message says that the lifecycle-compiler contains annotation processors, so you should add them to the annotationProcessor configuration. To do this, add the following line at the apply plugin section for your app.gradle:
apply plugin: 'kotlin-kapt'
This will enable the kotlin annotation processor support. Next, change the:
implementation 'androidx.lifecycle:lifecycle-compiler:2.0.0'
to allow the compiler to use the included annotation processors:
kapt 'androidx.lifecycle:lifecycle-compiler:2.0.0'
and that should compile fine.
I can't run my project after adding the #EActivity Annotation to my class.
This is my Gradle Project:
// 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.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// 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
}
This is my Gradle Module:app
apply plugin: 'com.android.application'
def AAVersion = '4.2.0'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.tasks"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:support-annotations:28.0.0'
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"
}
After I added the Android Annotations in my Gradle I noticed that my AndroidMannifest didn't get automatically modified (Missing the _ in the activity), and when I add that manually it gets highlighted in red.
If I run the project normally (Without modifying the AndroidMannifest or changing the class to Annotations) it will run normally.
If I add the annotations and modify the Manifest I'll receive the error:
error: Could not find the AndroidManifest.xml file, using generation
folder
[C:\Users\Asusc\AndroidStudioProjects\Tasks\app\build\generated\source\apt\debug])
Any idea what I might be doing wrong?
In my case, adding this to build.gradle fixed it:
android {
...
defaultConfig {
...
javaCompileOptions {
annotationProcessorOptions {
arguments = ["androidManifestFile": "$projectDir/src/main/AndroidManifest.xml".toString()]
}
}
}
}
You should update to AndroidAnnotations 4.6.0 . This version has Android Gradle Plugin 3.3.+ support.
If you are using AndroidAnnotations 4.6.0 with Android Gradle Plugin 3.5.+, you can downgrade the Android Gradle Plugin version to 3.4.1 to fix.
classpath 'com.android.tools.build:gradle:3.4.1'
I get the following error ERROR: Could not find method android() for arguments [build_9fawur68cjcg5sfkvki95w8sr$_run_closure1#30cec325] on project ':app' of type org.gradle.api.Project.
I'm not sure why I get this error, and I've tried many other things to see if I can get it to work. Although it never does.
App level gradle has been modified many times none of which fix the issue. Project level gradle doesn't work right either.
App level gradle
android {
compileSdkVersion 28
defaultConfig {
applicationId "net.troop59.LoginFirebase"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-core:16.0.6'
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'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:28.0.0'
//add this line
compile 'com.google.firebase:firebase-auth:16.1.0'
}
apply plugin: "com.google.gms.google-services"
Project level gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
You are missing the line
apply plugin: 'com.android.application'
at the very beginning of your app-level build.gradle file.
More info
An example on github
You should also have this dependency in the project-level build.gradle:
dependencies {
...
classpath 'com.android.tools.build:gradle:3.3.0'
...
}
UPDATE #1
You must add the google repository:
allprojects {
repositories {
google()
jcenter()
}
}
As I can't add a comment ,so I will add Answer
you should also
Change every Compile to Implementation
then Invalidates Cashes and restart (as follows)
[