I'm trying to build a Flutter app that also runs custom Java code, so that I can execute code in the background, set alarms etc. As such, I'd like to access Firebase from Java.
I've created a new Flutter project in Android Studio and added Firebase as documented here (manually).
It compiles and runs fine on the device, but it seems that the dependency .jars from Gradle are not picked up in Android Studio, and as a result my Java source files show a lot of errors - source being "cannot resolve symbol 'google'" in the import statements.
Is there anything special that I need to do in order to have Android Studio pick up external Java dependencies from Gradle in Flutter application projects? I'm running Android Studio 3.0 Beta 7.
I have the same issue and would love to find the solution. I tried directly downloading the .aar file and using this guide but it did not work either.
https://github.com/yushulx/flutter-android-aar
Edit: I found an open issue on the topic which can be found here. Clearly you have found it, but in case anyone else is looking for more information about this.
Edit 2: Here is a workaround.
Related
I cloned a project from GitHub using Android studio and I tried to run it, but I get the following error when trying to run it:
This should be able to run as I was the one that made it and uploaded it to GitHub. I just couldn't figure out how to use GitHub so I decided to clone the entire project back on my computer and it wouldn't run. It's actually also one of the templates from Android studio.
I tried looking online and I saw posts mentioning options along the lines of "syncing project with gradle", but I can't find that option anywhere in Android studio.
Not sure if this adds more information but in my original project that works and runs, it is able to show the design of the app but in the cloned version it doesn't show any of that, just code.
Resync Gradle is in File->Sync project with Gradle Files.
Has the project been pulled? Have you checked the project for errors? Do a build and see what errors there are.
My guess is there is stuff in the project (i.e. libraries) that do not exist anymore in the version of Android Studio you are using. Maybe the project was created with an old version of android studio. Also, check the Gradle app file and see if there are any problems.
I wanted to work without android studio as it really slows my laptop down.So I after research I got to the deprecated android command.As it is deprecated ,Is there another way to create android apps without android studio
I also looked at cookie-cutter and similar apps.They all have one problem-They don't dynamically update the android gradle plugin on updates and are also separated from the android command line tools
Some more information about your project could be useful.
If you're using Gradle, each of your build variants/flavors will have a command for building.
More information can be found here:
https://developer.android.com/studio/build/build-variants
and
https://developer.android.com/studio/build/gradle-tips
I'm not exactly sure what caused this or when it occurred but all of imports in MainActivtiy.java were being used successfully without any errors. The app compiled and has been working great. I went back and added some images in my #drawable folder and them added them in my .xml file. Some time after that, every OpenCV class and keyword imported is now an error with "Cannot Resolve Symbol [symbol]." I have tried every suggestion I found with no luck. My app still works, but I can not edit or anything OpenCV keywords.
I was using Android 3.2.0 with OpenCV 3.20, I updated Android Studio to 3.2.1.
Things I have tried, all with no success:
*Everything from this question including
-Delete .idea folder and .iml folder and re-imported project
-Invalidate cache/restart
-Set source and target compatibility to 1.8 for the app and opencv module
-Clean/Rebuild
*Everything from this question that was not repeated
*Update Android Studio
*Remove and re-install opencv
*Close and re-open Android Studio
*Restart computer
What is strange is that everything was fine and then this suddenly happened without much warning. Also, when I click on the OpenCV resources and click on the .java files, they all say "File was loaded in the wrong encoding: UTF-8" and I can't see anything. I followed the steps here when loading OpenCV and whenever I have looked up declarations or anything else in these java files there was no issue. How can I resolve this?
I tried a few more things including:
-Making a new project and coping the code from the old one over, same issues
-Re-installing Android Studio and importing old project, same result.
The only thing that solved my problem was uninstalling Android Studio, then re-installing it and making a new project. I copied the code over and imported the OpenCV module and all the errors went away. I went from version 3.2.0 to 3.2.1 as well
I am being pestered by eclipse when I open the program. I get two error messages; "SDK Platform tools component is missing! ..." and "Failed to get the required ADT version number from the SDK. The Android developer toolkit may not work properly".
Both messages give me the option to open the Android SDK manager. When I attempt to open the Android SDK manager from eclipse, I get an initialization and then nothing happens.
I'm aware this is a common problem. Many solutions say to find the Android SDK manager in the SDK directory, though I can't find it anywhere there. The path I am using is "C:\Users\Ant\AppData\Local\Android\sdk".
When I attempt to open the SDK manager from Android Studio, I get something come up, though I have no idea if it is the Android studio version of the SDK manager or not.
All I want to do is install some packages to get everything running smoothly. I have the feeling that I need to open the SDK manager from eclipse to do it though. Is this correct? Is there anything else I can do?
You should go and create the proper environment setup, It seems there is a confusion between Eclipse and android studio working env. Please make sure to install separately the working env. SDK are normally hidden files make sure you are suppose to see hidden files in your computer.
Thanks,
Ashish
Can we use Android studio for AOSP(Android Open Source Project) development, is there a way to do it. I didnt find one. anybody got any idea on this please ?
You can use Android Studio as a IDE for AOSP, since it's just a modified version of InteliJ's IDE.
from AOSP root:
make idegen && development/tools/idegen/idegen.sh
Then just "Open Project" in Android Studio and select the android.ipr it generated.
To import AOSP source in Android Studio or Eclipse, follow the full instructions here :
https://android.googlesource.com/platform/development/+/master/tools/idegen/README
What Pedlar suggested above is one way of doing it. I ran into lot of Jar dependency issues when I tried it with IDEA community edition (Android Studio is a fork of IDEA IDE). The IDE keeps prompting you about duplicate jars etc. The generated project includes framework Java sources as well as App sources. I tried to build an App project which resulted in broken AOSP build. IMHO, IDEA is a great IDE for Java development. But didn't work well with AOSP.
What worked for me is using eclipse to browse/edit/debug framework sources, but build the code from a terminal window. To avoid AOSP build breaks, please create a shadow dir of AOSP (i.e. lndir of AOSP) and use shadow dir for eclipse project.
This is explained at Using eclipse to browse/edit AOSP link in step by step.
If you are working on AOSP, you might want to check Debugging Android framework services.