could not resolve all dependencies for configuration ':runtime' - web

I am studing Mybatis and this is my build.gradle file
but when I refresh it,IntelliJ IDEA told me "could not resolve all dependencies for configuration ':runtime'"
How can I fix it?

It seems, you have an "offline mode" turned on, while created your Gradle project in IDE. Check the project setting, find a Gradle tab and turn off "Offline mode". Here you can find some more related info, about the way to disable it.
Note, that this option is used to turn off any Gradle network activity and make it impossible to download your dependencies if the are not yet cached or not added via file dependencies.

Related

GradleException: Crashlytics could not determine stripped/unstripped native library directories

There is plenty of "chatter", but I did not find an answer for my project.
While performing the Gradle Sync in my project with Crashlytics, Gradle fails to sync. I have other projects that are just fine and when I 'diff' the build.gradle files and other Android Studio settings, they have the same values and settings related to Crashlytics.
A problem occurred configuring project ':app'.
> org.gradle.api.GradleException: Crashlytics could not determine stripped/unstripped native library directories for project ':app', variant Debug. These are required for generating symbol files when NDK build tasks cannot be automatically inferred. Please specify strippedNativeLibsDir and unstrippedNativeLibsDir in the firebaseCrashlytics extension.
I am not looking for someone to triage my configuration, instead I want to know where in my project files can I find the "firebaseCrashlytics extension" and its configuration and where are the stripped and unstripped files so I can supply a path? If you know the answer from documentation, please share the link.
Make sure your android/app/build.gradle has the following:
release {
// ...
firebaseCrashlytics {
nativeSymbolUploadEnabled true
strippedNativeLibsDir 'build/intermediates/stripped_native_libs/release/out/lib'
unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
}
// ...
}
See https://github.com/invertase/react-native-firebase/issues/4253#issuecomment-797187492
In my case, I had a few projects cloned locally of the same repo. One of them was for a too old branch. Like 3-4 years back. For it, I have given a path to another NDK in the local.properties file.
ndk.dir=C\:\\NDK\\android-ndk-r13b\\android-ndk-r13b
It was causing my problem with the recent branches. After deleting it - it worked. So even if it is not the exact same case for you - it is most likely that you are building with the wrong SDК. Try updating in the SDK manager or maybe actually try explicitly saying what you need as I was doing above.
In my project-level build.gradle, Android Studio recommends updating the the firebase-crashlytics-gradle from 2.1.1 to 2.4.1. When I take the upgrade recommendation, the gradle sync fails, therefore I am unable to build my project. The error was obscured as I inherited this old project that is several versions behind and I updated all (most) of the frameworks and could not pin-point to this single dependency. I started over and upgraded selectively piecemeal until this was the lone down-level dependency.
I will try again at a later time when there is yet another update
to include.
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'org.jacoco:org.jacoco.core:0.8.0'
// Unable to build with v2.4.1 of firebase-crashlytics-gradle on this version of build (2021/02/02)
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
}

How to use offline gradle distribution instead of wrapper in latest Intellij/Android Studio "For new projects"?

As of this question, I was able to specify gradle distribution for offline "existing" project builds by downloading latest version from https://gradle.org/releases/ and specifyinng them inside the Setting->Build,Execution,Deployment->Build Tools->Gradle
But for opening settings for new projects I've no option to configure
them. I got this screen when I open the Gradle settings for new projects.
There is no option to configure "Use gradle from":
Downloading gradle for every new project of around 150 MB is not very feasible.
So how do i specify the offline gradle distribution for new projects?
Currently it's not possible. Please follow the related request on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-215792

What does the Android Studio delegateBuildRunToGradle do?

I'm trying to resolve some dependency issues when using an externally installed Gradle, rather than the one that come with Android Studio (AS). I then came across the particular AS setting under
File > Settings > Build,Execution,Deployment > Build Tools > Gradle > Runner.
[x] Delegate IDE build/run actions to Gradle
This is apparently also available as the Gradle config delegateBuildRunToGradle. But I can't find any sane explanation as to what it does. I thought all AS builds used Gradle...
While the Gradle doc page say it's on by default. This was not the case for my AS 3.2.2.
What does this option do?
(When should it be used?)
I was hoping to have a more precise answer, but since nothing has come forward here, I guess the only answer is that (what is written in the screenshot above) the IntelliJ IDEA has it's own way to make the builds. For many practical purposes it is probably better to have a more updated and working Gradle installation and enable the above option, to let it do its job.

java.io.filenotfoundexception for AndroidManifest.xml

After Android SDK updated to 6.0 today, I am unable to run my project. The error is:
Gradle 'Alphaets' project refresh failed.
Cause:java.io.FileNotFoundException: ...\project_name\src\main\AndroidManifest.xml(The system cannot find the path specified).
Actually, it should be ...\project_name\app\src\main\AndroidManifest.xml. Part ...\app\... is missing. There is no \src\ folder in \project_name\. That's why AndroidStudio cannot find AndroidManifest.xml.
What causes such an error? How should I revise the gradle file to include the correct path of AndroidManifest.xml?
Besides, my build.gradle(Module:app) did not show up in the GradleScripts any more. I have to go to the absolute path of that file and open it with notepad++. What's wrong with that?
It turns out to be redundant codes in file "build.gradle(Project: MyProject)". I added these code:
dependencies{}
This prevents the file "build.gradle(Module:app)" from being loaded. I did not know the principle, but after I deleting these lines, the project works.
I am also had the same Issue, when I am trying to open existing project.
My problem is related to Facebook resource(D:\GiriBabu_project\CalendarApp-24-08-2016\CalenderApp\app\build\intermediates\res\merged\debug\drawable-mpdpi\some.png) not found.
I just update the existing Facebook-android sdk. then It resolved that issue.
So this issue always regarding to your dependencies. Just find the error regarding to which package in your dependencies and update it.
Another mistake may be your SDK version not match with the in gradle version. so you should change the SDK versions also. (existing projects SDK version numbers not update automatically)
if you don't know the proper version number just create the new project, then automatically know the gradle version and sdk versions.

IntelliJ unable to recognize groovy String

I am using IDEA - 11.1.1 and gradle - gradle-1.0-milestone-9 (I tried with release candidate 3 also) on windows-7 (if this matters)
After importing gradle porject, IDEA complains about String object. I think I am missing something about grrovy configuration. I have also marked - main and test folder as Sources and Test Resources respectively. Did I miss something obvious?
Most likely the JDK isn't set correctly in IDEA. Go to File -> Project Structure -> Project and check/fix Project SDK.
Try checking your project and module sdk.
On your module select F4 or Right click "Open Module Settings"
Check your SDK and Moduel SDK
I am sure that will resolve your problem.
Check your IDEA project settings and look if your JDK is configured properly.
I suggest you use the gradle idea plugin to create your IDEA project files, instead of using the import function of existing gradle projects into IDEA, since from my experience it gave me troubles. Also adding new jars via gradle and updating your IDEA project files via gradle seems more consistent.
I uploaded a build.gradle gist, which might give you a good start:
https://gist.github.com/1580234
It contains some explanatory comments.
Greets,
Jan

Resources