Could not resolve de.measite.minidns:minidns:[0.1,0.2) - java

I am quite new into Android World. I have added SMACK 4.1.0 for developing XMPP connectivity. While trying to build app, got below errors consistently. Tried googling but no fruitful results. Kindly provide your help.
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not resolve de.measite.minidns:minidns:[0.1,0.2).
Required by:bind:app:unspecified > org.igniterealtime.smack:smack-android:4.1.0 > org.igniterealtime.smack:smack-resolver-minidns:4.1.0
Failed to list versions for de.measite.minidns:minidns.
Unable to load Maven meta-data from https://jcenter.bintray.com/de/measite/minidns/minidns/maven-metadata.xml.
Could not GET 'https://jcenter.bintray.com/de/measite/minidns/minidns/maven-metadata.xml'.
peer not authenticated
Build.Gradle(Project:bind) file is :-
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Build.Gradle(Module:app) file is :-
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.sukeshsaxena.bind"
minSdkVersion 8
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
//Smak config for XMPP over TCP
compile "org.igniterealtime.smack:smack-android:4.1.0"
compile "org.igniterealtime.smack:smack-tcp:4.1.0"
}
Let me know if anything else is required.

Newest version of
de.measite.minidns:minidns is 0.1.7
org.igniterealtime.smack:smack-resolver-minidns is 4.1.3.
Try to use
de.measite.minidns:minidns:0.1.7
org.igniterealtime.smack:smack-resolver-minidns:4.1.3
in your gradle file.

Related

android.support.design.widget.TabLayout - cannot resolve symbol 'design'

I tried to import android.support.design.widget.TabLayout, but I got cannot resolve symbol 'design' error.
In the First I sought that is a problem with a implementation com.android.support:design version (in gradle Module).
But it is not.
I managed to find the cause of this error - dependencies versions (in gradle Project).
My dependencies version is:
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.google.gms:google-services:4.3.3
'
So if I use older version - this is fixing the error.
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.2.1'
I do not understand why It does not work with newest versions.
Please help me understand this, why I cannot use new versions.
My android studio vesrion is: 4.0
gradle Module:
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "mv.group.qwerty"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
gradle Project:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Solution 1:
add this to your build.gradle(Module:App) dependencies,
implementation 'com.android.support:design:28.0.0-alpha3'.
Also Make sure that all Android Support dependencies have the same version like below:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation "com.android.support:cardview-v7:28.0.0-alpha3"
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha3'
implementation 'com.android.support:design:28.0.0-alpha3'
}
Solution 2:
Did you convert your dependencies to androidx?
In Menu, press Refector and select Migrate to AndroidX, press sync gradle and it should solve this issue.
and use implementation 'com.google.android.material:material:1.0.0' instead of implementation 'com.android.support:design:28.0.0-alpha3'

Switching Android module from library to application results in "Unable to resolve dependency for :app#debug/compileClasspath"/

I have an android app I want to import to my project as a module. The module syncs and compiles fine with apply plugin: 'com.android.application' However, there are classes from the module that I want to use in my project. To do this, it seems like I need to switch the gradle for the module to read apply plugin: 'com.android.library' as per this question. However, changing the module from an application to a library results in the following error log:
Unable to resolve dependency for ':app#debug/compileClasspath': Failed to transform file 'OCRTest-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Failed to transform file 'OCRTest-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
...
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Failed to transform file 'OCRTest-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
So far I have tried invalidating caches and restarting Android Studio, as that was a common suggestion. I have also seen it suggested to delete the .gradle file altogether. Is that safe to do? Also, the main thing I want to do is be able to use Java classes from the module in my app's activities. If there is a better way to go about doing this, let me know.
Here is the code for my .gradle files.
settings.gradle:
include ':app'
include ':OCRTest'
build.gradle(Project):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// 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
}
build.gradle(Module: OCRTest): This is the module that contains classes I want to use in my app
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 27
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}
}
}
dependencies {
implementation 'com.rmtheis:tess-two:9.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
}
build.gradle(Module: app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "org.noblis.thirdeye"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
matchingFallbacks = ['debug']
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.rmtheis:tess-two:9.0.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 project(path: ':OCRTest', configuration: 'default')
}
Remove the following line from build.gradle(Module:app):
implementation project(path: ':OCRTest', configuration: 'default')
Sync Gradle files.
Replace settings.gradle with this line:
include ':app', ':OCRTest'
Sync Gradle files again.
Now goto Project Structure>Add Module dependency and add module.
Hope this helps :)

How i can export Android code to java library in Android Studio

I'm developing a library for an Android application, I wrote some classes that contains different functions.
I have a problem in the exporting process from Java to Jar. I did the following:
1) From an existing source code, File -> New module -> Java Library
2) Android Studio at this point create a "sub project", with a default class
3) Cut and paste my java code in the library created at point 2
At this point I have some problems/questions:
Some part of code cannot be resolved like ByteBuffer, JSON...
Should I import in the JSON - HTTP library?
I don't understand why ConnectivityManager, NetworkInfo cannot be resolved.
EDIT 1
app gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "MY ID"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile files('libs/httpcore-4.4.4.jar')
}
Di gradle
apply plugin: 'java'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Project 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:2.1.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
}
The problem is that you are moving the code in another subproject and then building it differently. To fix this, assuming you are using Android Studio, move into your module Gradle.build file all the library you need in the new module.

Not able to add dependecy in gradle(Android Studio)

I am trying to add this dependency https://github.com/hoang8f/android-flat-button in to my android studio project and I am getting
Error:(26, 13) Failed to resolve: info.hoang8f:fbutton:1.0.5
I am able to add google play services dependency easily without any problems.
Below is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.planner"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'info.hoang8f:fbutton:1.0.5'
}
Solutions tried:- 1.)Gradle is working in online mode not offline.
2.)Cleaned and builded/rebuilded the project.
3.) Changed to
repositories {
mavenCentral()
}
in my root gradle file
4.) Tools->android->Sync Project with gradle files
Still no luck in making it work.
P.S.:- Not that it effects the questions, I faced the same problem while trying to add parse sdk via gradle, so I added the jar file independently.
add
repositories {
mavenCentral()
}
include android tag
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.planner"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
mavenCentral()
}}
Please try this. Add fbutton-1.0.5.aar file into your lib folder.
repositories {
flatDir {
dirs 'libs'
}
}
Add aar file into dependencies.
dependencies {
compile(name:'ARFile', ext:'aar')
}
Did you noticed how looks like build.gradle of a demo project?
https://github.com/hoang8f/android-flat-button/blob/master/demo/build.gradle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 2
versionName "1.1"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
} }
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.larswerkman:HoloColorPicker:1.4'
compile fileTree(dir: 'libs', include: ['*.jar']) // compile project(':library')
compile 'info.hoang8f:fbutton:1.0.5'
}
Check if you're not missing something in your Gradle file or you put something wrong
EDIT: I've put whole your build.gradle file into my new project and it's work fine.
If rebuilding not help, create a new clean project and put this build.gradle. Tell me is it works with new project.
EDIT2:
In your project you have two build.gradle change the second one to
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:1.5.0-beta2'
}
}
allprojects {
repositories {
jcenter()
}
}
I had the same problem.
Invalidate cache and restart your android studio. Then sync gradle.
I cloned the project and used "demo" module to test the lib. The lib that you needed was downloaded successfully and this is expected, because it exists in the maven repo
The only point I noticed - probably you may have problems with gradle, because there's runProguard command, that is not used in gradle no more.
So you may just delete it or change to minifyEnabled false.
After doing this, demo project assembles successfully

Import volley into Android Studio 1.3.0 project

I am having trouble in importing and using the volley library in the android studio 1.3.0 project. I have followed tutorials online to import the volley from git into the project directory.
Now, I am having trouble in making it work with the project. I am unable to build it using instructions online.
Error it generates is:
Error:(23, 0) Gradle DSL method not found: 'compile()'
Possible causes:The project 'Hrup' may be using a version of Gradle that does not contain the method.
Gradle settingsThe build file may be missing a Gradle plugin.
Apply Gradle plugin
I have included files like, build.gradle for all folder, and settings.gradle
Build.gradle (volley)
// NOTE: The only changes that belong in this file are the definitions
// of tool versions (gradle plugin, compile SDK, build tools), so that
// Volley can be built via gradle as a standalone project.
//
// Any other changes to the build config belong in rules.gradle, which
// is used by projects that depend on Volley but define their own
// tools versions across all dependencies to ensure a consistent build.
//
// Most users should just add this line to settings.gradle:
// include(":volley")
//
// If you have a more complicated Gradle setup you can choose to use
// this instead:
// include(":volley")
// project(':volley').buildFileName = 'rules.gradle'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
compile project (':volley')
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion = '22.0.1'
}
apply from: 'rules.gradle'
dependencies {
}
Build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.bali.hrup"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
}
Build.gradle(Hrup{my project name})
// 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:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Settings.gradle
include ':app'
include ':volley'
Just a Small Change, Edit the file build.gradle(app), not the build.gradle(volley)
Just add a single line
compile project (':volley')
Final file(build.gradle(app)) will look like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.bali.hrup"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile project (':volley')
}

Categories

Resources