The kotlin-android-extensions plug-in still reports an error when the app directory and project directory are added.
enter image description here
Add the following to build.gradle in the project root directory:
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Related
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.google.gms:google-services:4.3.14'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Firstly you shouldn't use app level build.gradle file's dependencies. Read the comment there. That section is not for libraries. You must open your app level build.gradle file and view dependencies section there. And you should use pdf viewer library there correctly. Use it like this:
dependencies {
implementation 'com.github.barteksc:AndroidPdfViewer:2.0.0'
}
And add this to your build.gradle files:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Please check your build.gradle where you might be using Signing configs keys but it's not fetched properly. Also check your buildTypes.
I create a project, both build.gradle (Project) and build.gradle (Module) are listed in Android folder structure normally, look likes Old Image 1, then I sync the project to remote GitHub in Android Studio 3.4.1.
I clone the project from GitHub in another PC, I find that build.gradle (Project) disappear in Android folder structure in the another PC, look likes New Image 1, but I can find it in Project folder structure, look likes New Image 2. Why? BTW, the clone project can work well.
It seems that Github cause the problem, how can I fix it? Thanks!
Old Image 1
New Image 1
New Image 2
To InsurgentPointerException:
This is project level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.40'
ext.anko_version = '0.10.8'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
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()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Again to InsurgentPointerException:
You can test it by clone from
https://github.com/mycwcgr/aa
You can download the project source code of Android Studio at
https://www.dropbox.com/s/ko8stedl135ohnt/MyTest.zip?dl=0
So it seems like the Developers did that intentionally. IDK there probably used to be some setting for it but now I can't find it. This solution is a (rather lengthy) workaround.
Close the target project
Rename the root project folder
Open the renamed project (Optional)
See that there is build.gradle and app/build.gradle in the the Android View > Gradle Scripts (Optional)
Close back out of the project (Optional)
Do 1 -> 4 again but renaming back to the old project name.
why i'm gonna get this error?, how to fix it, i've tried to follow any intro, but it couldn't get fixed.
Gradle project refresh failed
Error:Could not download artifact 'com.android.tools.build:builder:0.12.2:builder.jar': No cached version available for offline mode
my build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
thanks for your solution/ideas.
Go to Settings->Build,Execution,Deployment->Gradle. And check Offline Work and try again.
Go to Settings->type gradle in search box and click on the result and uncheck the offline work
As soon as I open an Android Studio project, I get a warning saying "Gradle Sync Failed" and this error:
Gradle sync failed: Cause: ch.qos.logback.classic.LoggerContext cannot be cast to org.gradle.internal.logging.slf4j.OutputEventListenerBackedLoggerContext
My build.gradle is:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.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
}
I've tried the suggested fixes and a clean install several times to no avail. I have OSX 10.10 with JDK 8 installed. Thanks in advance.
Remove slf4j* jars files from /Library/Java/Extensions.
Use below command to see files in Extensions directory:
ls /Library/Java/Extensions/
See this question and it's answer here
I hope it's helps you.
I read this page, that learn "importing libraries into android studio". but it's doesn't work for me. i do those step for Material Design Library. in Material Design's build.gradle file have:
https://github.com/navasmdc/MaterialDesignLibrary/blob/master/MaterialDesign/build.gradle
when i click on "Sync Project with Gradle Files" it's gives me two error:
Error:(2, 0) Plugin with id 'com.github.dcendents.android-maven' not found.
Error:(3, 0) Plugin with id 'com.jfrog.bintray' not found.
Can any one tell me how to solve those error's?
note: i read this, but don't understand.
If you want to download the Material Design Library and import it without using the gradle method pyus13 mentioned, you need to add the following lines to the MaterialDesign Build.gradle file:
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
}
}
To find this file, you can double click on the error you get when syncing that looks like this:
Error:(2, 0) Plugin with id 'com.github.dcendents.android-maven' not found.
I also had to add compile project(':MaterialDesign') to the app build.gradle file.
Dont follow the above tutorial, the shown approach is useful when the library has not published as maven or gradle dependency.But as Github page say it is published on maven.
So remove the module or library project completely from your project and use gradle dependency instead.
Just copy this in your app module's build.gradle inside dependencies closure
dependencies {
// YOUR OTHER DEPENDENCIES
compile 'com.github.navasmdc:MaterialDesign:1.+#aar'
}
Sync your project with gradle.
This was kindly answered #pyus13 but I would like to give the complete answer, with the source, github.com/navasmdc/MaterialDesignLibrary#howtouse:
You can use the gradle dependency, you have to add these lines in your
build.gradle file:
repositories {
jcenter()
}
dependencies {
compile 'com.github.navasmdc:MaterialDesign:1.+#aar'
}
The build.gradle you are looking for is in ProjectName\app\src.
Add two dependencies in your Project build.gradle
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}