Android Studio "unused import" message when putting SDK inside build.gradle - android

I'm trying to insert an SDK called Mesibo for communication, and in my project it instantly greys out when I try to import: import com.mesibo.api.mesibo; with the message cannot resolve symbol 'mesibo' and unused import around it
This is the build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.richard.myapplication"
minSdkVersion 15
targetSdkVersion 28
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 'com.mesibo.api:mesibo:1.0.5'
implementation 'com.mesibo.api:calls:1.0.3'
implementation 'com.mesibo.api:ui:1.0.4'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
}
import com.mesibo.api.mesibo;
I'm following their documentation, and the import stops gradle from syncing with the project for some reason. I'm very new to Android Studio and this is my first time attempting to place an SDK + API in.

This goes in your Java/Kotlin code, not in Gradle
import com.mesibo.api.mesibo;
So remove it from there, and then compile the code, then add it to the other source files you need this class.
And I think that their documentation is very poor... should be
import com.mesibo.api.Mesibo;
https://github.com/mesibo/samples/tree/master/android/MesiboSample/app/src/main/java/com/mesibo/firstsample

Related

when I import opencv with android studio it not done

when I import opencv with android studio it not done.
Android studio version 3.6.2
opencv version
when i import opencv module
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.thu"
minSdkVersion 14
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 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(path: ':java')
}
Error :
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could
not resolve project :java.
Show Details
Affected Modules: app
How can I solve this?
Why this error comes how can i solve this error?
what mistake i did in this?
I followed this youtube tutorial.
My another question.

'Cannot resolve symbol' (design + v7 + annotation)

A friend of mine sent me some activity from his app. I created a new activity for each one and copy-paste the code in the new empty activity. Now I got some problem with the imports:
import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.support.v7.widget.RecyclerView;
import android.support.annotation.Nullable;
And here there is my Gradle - app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.example.progand"
minSdkVersion 26
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.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02'
}
I tried adding all the depedences that i found online and nothing solved the problem, it still gives me the error "cannot resolve symbol 'design/v7/annotation' " and I can't run my app to test the activities.
I really dunno what I'm doing wrong, sorry if it seems naive but it's my first time trying android studio 3.4.2, SDK Version 29.0.2.
Do not mix com.android.support and androidx artifact. You should be using all the dependencies of androidx only.
Replace
implementation 'com.android.support:design:28.0.0' with implementation 'com.google.android.material:material:1.1.0-alpha08'.
Remove implementation 'com.android.support:recyclerview-v7:28.0.0' since you already have androidx dependency of RecyclerView.
Now See Artifact mapping.. Use same latest versions for all androidx libraries.
Check out Class mapping.
android.support.design.widget.TextInputEditText =====> com.google.android.material.textfield.TextInputEditText
android.support.design.widget.TextInputLayout ======> com.google.android.material.textfield.TextInputLayout

Can't import android.support.v7 and annotation libary with gradle

Im trying to go through this tutorial Android Implementing Preferences Settings Screen
He imports android.support.v7... and android.suppor.annotation libary...
I did the most suggested answer and implemented these packages to my build.gradle and resynced it.
Android studio can't resolve v7 and annotations.
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
gradle.build:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "info.androidhive.preferences"
minSdkVersion 19
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 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.android.support:appcompat-v7:+'
}
I expected, that after resyncing the libarys would be available and not the error message
cant resolve symbol v7 for instance.
Thanks for help.
You are using androidx: implementation 'androidx.appcompat:appcompat:1.0.2'.
In your code you have to import the correct class:
import androidx.appcompat.widget.Toolbar;
Also remove in your build.gradle
//implementation 'com.android.support:appcompat-v7:+'
For the annotations use:
androidx.annotation:annotation:1.1.0

How to set up correctly the OSMbonuspack in my project?

Hello guys I tried to install the osmbonuspack in an Android Studio project. I tried this with the osmbonuspack wiki, but when I try to sync my project I get an error in this dependency. I assume that this is a compatibility problem. Can you please suggest me a solution?
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "mytestapplication.hello.com.map"
minSdkVersion 16
targetSdkVersion 28
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: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 'org.osmdroid:osmdroid-android:6.0.1'
implementation 'com.github.MKergall:osmbonuspack:6.5.2'
}
-This dependency returns the error:implementation 'com.android.support:appcompat-v7:28.0.0'
SDK 28 is not compatible with appcompat-v7.
You can now upgrade to osmbonuspack 6.5.3, which get rid from this dependency to appcompat-v7.
(and also upgrade to osmdroid 6.0.3)

Cant generate aar file from project

I am new in creating library from android studio. I have been reading this tutorial in developers website. So to try it out I have created a new project and without doing anything I edited the app level build.gradle file and here is how it looks like:
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 15
targetSdkVersion 28
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: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'
}
Now when I am trying to build an apk(which is supposed to build aar file) isn't building anything as I cant see any confirmation message like something when I build an apk nor can't I find anything inside app/build/outputs folder..
Where am I going wrong? Is there anything that I am understanding wrong in the tutorial?
Here is the project structure - screen shot

Categories

Resources