Importing Libraries on Android Studio like on Eclipse












1















I just started using Android Studio actively last month and I have really worked hard to learn my way around it. Apart from a lot of different shortcuts here and there something is giving me headache. Do I really have to know every library to set up my project error free?



Now after copying code from SO I just can't find how to add the import libraries. On Eclipse the compiler when it shouted of a missing library, a simple hover on the error line was all I needed to fix the missing library since a context menu often revealed suggestions of the missing library.



For instance, if I add the code:



Private Locale locale;


The compiler will say:




error: cannot find symbol class Locale




How do I solve such an issue without having to which class or library needs to be imported here? By the way, I have no problem importing Eclipse projects to Android Studio.



Here is what I have tried so far:




  1. Clicking on red line, then pressing Alt + Enter.

  2. Enabling Auto Imports from settings


None of them seem to be working at all. As I wait for help I have to google whatever library I really need to import to my class.










share|improve this question

























  • You can directly export your project for android studio from eclipse

    – Muhammed Fasil
    Nov 27 '18 at 6:44











  • I think you never understood my question at all. Am talking of code and not a whole project.

    – Oyonde
    Nov 27 '18 at 6:45











  • Check my updated question

    – Oyonde
    Nov 27 '18 at 6:49











  • have you tried this import java.util.Locale;

    – Muhammed Fasil
    Nov 27 '18 at 6:54











  • That was just an example among many problems i need to solve

    – Oyonde
    Nov 27 '18 at 7:22
















1















I just started using Android Studio actively last month and I have really worked hard to learn my way around it. Apart from a lot of different shortcuts here and there something is giving me headache. Do I really have to know every library to set up my project error free?



Now after copying code from SO I just can't find how to add the import libraries. On Eclipse the compiler when it shouted of a missing library, a simple hover on the error line was all I needed to fix the missing library since a context menu often revealed suggestions of the missing library.



For instance, if I add the code:



Private Locale locale;


The compiler will say:




error: cannot find symbol class Locale




How do I solve such an issue without having to which class or library needs to be imported here? By the way, I have no problem importing Eclipse projects to Android Studio.



Here is what I have tried so far:




  1. Clicking on red line, then pressing Alt + Enter.

  2. Enabling Auto Imports from settings


None of them seem to be working at all. As I wait for help I have to google whatever library I really need to import to my class.










share|improve this question

























  • You can directly export your project for android studio from eclipse

    – Muhammed Fasil
    Nov 27 '18 at 6:44











  • I think you never understood my question at all. Am talking of code and not a whole project.

    – Oyonde
    Nov 27 '18 at 6:45











  • Check my updated question

    – Oyonde
    Nov 27 '18 at 6:49











  • have you tried this import java.util.Locale;

    – Muhammed Fasil
    Nov 27 '18 at 6:54











  • That was just an example among many problems i need to solve

    – Oyonde
    Nov 27 '18 at 7:22














1












1








1


1






I just started using Android Studio actively last month and I have really worked hard to learn my way around it. Apart from a lot of different shortcuts here and there something is giving me headache. Do I really have to know every library to set up my project error free?



Now after copying code from SO I just can't find how to add the import libraries. On Eclipse the compiler when it shouted of a missing library, a simple hover on the error line was all I needed to fix the missing library since a context menu often revealed suggestions of the missing library.



For instance, if I add the code:



Private Locale locale;


The compiler will say:




error: cannot find symbol class Locale




How do I solve such an issue without having to which class or library needs to be imported here? By the way, I have no problem importing Eclipse projects to Android Studio.



Here is what I have tried so far:




  1. Clicking on red line, then pressing Alt + Enter.

  2. Enabling Auto Imports from settings


None of them seem to be working at all. As I wait for help I have to google whatever library I really need to import to my class.










share|improve this question
















I just started using Android Studio actively last month and I have really worked hard to learn my way around it. Apart from a lot of different shortcuts here and there something is giving me headache. Do I really have to know every library to set up my project error free?



Now after copying code from SO I just can't find how to add the import libraries. On Eclipse the compiler when it shouted of a missing library, a simple hover on the error line was all I needed to fix the missing library since a context menu often revealed suggestions of the missing library.



For instance, if I add the code:



Private Locale locale;


The compiler will say:




error: cannot find symbol class Locale




How do I solve such an issue without having to which class or library needs to be imported here? By the way, I have no problem importing Eclipse projects to Android Studio.



Here is what I have tried so far:




  1. Clicking on red line, then pressing Alt + Enter.

  2. Enabling Auto Imports from settings


None of them seem to be working at all. As I wait for help I have to google whatever library I really need to import to my class.







eclipse android-studio






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 27 '18 at 14:15









E_net4

12.3k63569




12.3k63569










asked Nov 27 '18 at 6:24









OyondeOyonde

738




738













  • You can directly export your project for android studio from eclipse

    – Muhammed Fasil
    Nov 27 '18 at 6:44











  • I think you never understood my question at all. Am talking of code and not a whole project.

    – Oyonde
    Nov 27 '18 at 6:45











  • Check my updated question

    – Oyonde
    Nov 27 '18 at 6:49











  • have you tried this import java.util.Locale;

    – Muhammed Fasil
    Nov 27 '18 at 6:54











  • That was just an example among many problems i need to solve

    – Oyonde
    Nov 27 '18 at 7:22



















  • You can directly export your project for android studio from eclipse

    – Muhammed Fasil
    Nov 27 '18 at 6:44











  • I think you never understood my question at all. Am talking of code and not a whole project.

    – Oyonde
    Nov 27 '18 at 6:45











  • Check my updated question

    – Oyonde
    Nov 27 '18 at 6:49











  • have you tried this import java.util.Locale;

    – Muhammed Fasil
    Nov 27 '18 at 6:54











  • That was just an example among many problems i need to solve

    – Oyonde
    Nov 27 '18 at 7:22

















You can directly export your project for android studio from eclipse

– Muhammed Fasil
Nov 27 '18 at 6:44





You can directly export your project for android studio from eclipse

– Muhammed Fasil
Nov 27 '18 at 6:44













I think you never understood my question at all. Am talking of code and not a whole project.

– Oyonde
Nov 27 '18 at 6:45





I think you never understood my question at all. Am talking of code and not a whole project.

– Oyonde
Nov 27 '18 at 6:45













Check my updated question

– Oyonde
Nov 27 '18 at 6:49





Check my updated question

– Oyonde
Nov 27 '18 at 6:49













have you tried this import java.util.Locale;

– Muhammed Fasil
Nov 27 '18 at 6:54





have you tried this import java.util.Locale;

– Muhammed Fasil
Nov 27 '18 at 6:54













That was just an example among many problems i need to solve

– Oyonde
Nov 27 '18 at 7:22





That was just an example among many problems i need to solve

– Oyonde
Nov 27 '18 at 7:22












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53493895%2fimporting-libraries-on-android-studio-like-on-eclipse%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53493895%2fimporting-libraries-on-android-studio-like-on-eclipse%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks