I am making an application with android studio, but I am writing code referring to various sites to send an email directly to my G-Mail from within the application, but an error occurs in some code parts It has come out and I investigated various things, but I am struggling because I can not understand the cause.
[Cannot resolve method'getInstance' in'Session' is displayed. ]
I wondered if I hadn't imported the library and tried importing various things, but I couldn't solve it. .. ..
Is this getInstance () itself no longer available?
I'm wondering if I'm overlooking something basic or if there are other deep causes.
I'm sorry, but I would appreciate it if you could give me some advice. .. ..
Thank you.] (Bf53bc09d705719bb2215ac076b1188e.png)
Answer # 1
While looking at the above site, I converted it to java and checked it
import javax.mail.Session;Are you using Session?
First, add a dependency on JavaMail for Android to the app module build.gradle.
As you can see, you have to add the following to the dependencies of the app's build.gradle.
implementation'com.sun.mail:android-mail: 1.5.5' implementation'com.sun.mail:android-activation: 1.5.5'
Is there anything that is xxx.Session in the part where imports are lined up at the top?
The one that was automatically imported when I first typed Session remains, so if I write it later, it will be like that.
So if there is a class with the same name in the imported class, it will be javax.mail.Session etc. to determine which class it is.
(The one imported first will be given priority)
Or just type Session and Ctrl click to see what file Session is currently used as Session.
(If you delete the import used earlier as Session, javax.mail.Session can be used as Session)
So the usage hasn't changed.
If you have the same name, you need to choose what to use.
- send an email from an android app [java mail]
- java - error when building android studio ml kit for firebase [plugin with id'comandroidapplication' not found]
- java - i want to fix an error in android studio
- java - i got an error when trying to execute a class that overloaded the constructor
- android - error a non-null string must be provided to a text widget
- java - i want to save the image obtained from the gallery in android studio as a file and load it into opencv
- about android application development in java
- i get an error when i try to put opencv into android studio
- i want to resolve a java error
- java - i want to use api level 26 or later on an android smartphone with an api level 23 smartphone
- i get an error in android studio and can't run
- fighting ice execution error [java]
- java - is there an api to control charging in android os?
- java - an error occurs when executing the jar file
- java - i want to get the entire list from the db and display it, but an error occurs when executing the application
- when i run /gradlew eclipse, i get an error if compilejava --release is an invalid flag
- android - error about gif
- java - web-app shows error in webxml
- java - processing to call another class from android studio mainactivity [line notify]
- java : Retrofit 2.3 follows the onFailure method
- java : The widget is not displayed
- java : Using Whatsapp in your application
- How to compile the project in Unity for Android with Gradle?
- java : Android In-App Billing v3 Library
- java : I can not turn off the audio playback in Exoplayer | NULLPOINTEREXCEPTION
- java : Why does ListView respond to a button pressing?
- java : Can't execute Http request to local android server
- java : How to remember User with SharedPreferences
- Flicts TextView when updating with RXJAVA