Not able to add dependency to android project in flutter - android

Hello I am new to flutter and i want to do native function calls using flutter, i wrote an sample native code app and it is working as expected. Now i want to use some packages on my android code, which is platform specific.
I have added my dependcies in my build.gradle file and it the gradle build is success,
But i cannot use the package there,
say for example: i have added the dependency for the com.squareup.okhttp3:okhttp:3.4.2 and gradle build is success and now icannot access their methods and other stuffs. Please let me know to what to do with it. Thanks in advance.enter image description here

Finally it worked, i opened the android project as an new android project in android studio which resolved the issue.

Related

How can I fix Project “MyApp” Is not a gradle based project

I’m doing some work on an existing flutter project which I have Imported into Android Studio. I’m receiving the below error when I’m trying sync the project after editing the gradle when connecting the project to Firebase.
I have edited the project and app level gradles as per the firebase instructions but get the below error.
Project “MyApp” Is not a gradle based project.
Just wondering how I can fix this?
Thanks
Your project mightnot complied with gradle. I suggest you only copy xml code and java class code into Android studio but at first creat a mainActivity into Android studio.Hope it will works.

How do I add in a class created in a different android project?

Please forgive the vague sounding title
I am trying to get this project to compile in android studio:
https://proandroiddev.com/how-to-create-a-bubble-selection-animation-on-android-627044da4854
https://github.com/igalata/Bubble-Picker
Downloading the github project and compiling it as it is did not work, I am getting this error, and redownloading dependencies and syncing as suggested in the error message did not work
UPDATE: I have upgraded android studio, gradle and kotlin plugin to latest version and it's still the same problem.
I can use the library version of this project just fine, using the steps described in the github page. I want to compile the source code of this component together with my project so that I can tweak the bubble animation itself. Since the github project itself does not compile, I created a Hello World project first, then manually copied in the bubblepicker folder in the Hello World project. Inside the bubblepicker folder, I changed the name of the folder tree java/com/iglata/bubblepicker to java/com/test/app/bubblepicker, and changed the package name of the files inside this folder to reflect this. I then copied the code in DemoActivity.kt to my MainActivity.kt and changed the package names and made few minor adjustments to make the compiler errors go away.
I have made some modifications in the gradle files as well so that gradle syncing does not give any errors. However, anything inside bubblepicker does not seem to be detected in the MainActivity.kt, or it's activity layout xml file. For example,
import com.test.app.bubblepicker.BubblePickerListener
is marked with red colour in android studio and the error is unresolved reference. If I remove all references to bubblepicker and replace the code in MainActivity.kt with the Hello World code, then it compiles and runs fine, so it's as if bubblepicker is not getting picked up by the compiler at all.
What could be the problem here?
Or at the very least, how can I compile the bubblepicker github project? Simply loading the whole project in Android Studio is giving me compiler errors. I am doing this on Android Studio 3.5 on macOS with Kotlin version latest as of September 4.
I didn't get any error while import Github project.
Kindly update your android studio and kotlin Gradle version and check same.

Include External Source Code Library for Android Studio 1.4.1

I'm attempting to create an Android app with Android Studio that uses source code from:
https://github.com/mapbox/mapbox-gl-native/
I will need to modify the source code, build and debug the changes, and commit those changes back to the forked repository I've made from mapbox-gl-native.
It appears much of the library code is in C++, while the project that uses the code will be in Java (if that makes a difference).
I've tried a bunch of things (mostly ignorant) and keep getting the following message:
Gradle 'name' project refresh failed
Error: Configuration with name 'default' not found.
Newbie on Android Studio, so please be as descriptive as possible. I'm using Android Studio 1.4.1, as other similar questions seem to have version specific answers.
Is there a description on how to set up an Android Studio project to include source code and how to structure such a project?
or
Can you tell me what the message means and how to fix it?
Thanks.

Integrate new relic sdk into a non-gradle project in android studio

I am trying to integrate new relic SDK into my app, and the problem is that the code is old and wasn't ported to gradle and we don't have time to port it. So when we try to add the new relic sdk into the project structure as a library is not working and it's throwing me an error that I can't get any feedback, the error is the following.
Failed to detect New Relic instrumentation. Something likely went wrong during your build process and you should contact support#newrelic.com.
NewRelic provides a video on their page for proper import in ADT/Eclipse. It is available on this page: https://docs.newrelic.com/docs/mobile-apps/android-installation-and-configuration
Generally, after adding a .jar to your library directory, you must set your build path correctly. Right click on your project, select Build Path -> Configure Build Path and make sure that the .jar appears in the Libraries tab and that it is checked in the Order and Export tab.
Anyways, regarding about the problem of not been able to build in android studio is fixed, but also I were able to import my code to eclipse and make it run and after that I make it work also in android studio without gradle. I have submitted a ticket to new relic just in case they are willing to create a new tutorial for people, like me, that are not using gradle an make it work in android studio.
This is the important line:
-javaagent:/path/to/newrelic-android-3.330.0/lib/class.rewriter.jar
you have to add this into your compilation parameters, and the only way to do it is through the preference of the android studio, instead of your project preference.
Try to find a way to add this command only for when we are building this project and not other ones. Let see.

Android Studio 0.2.9 and New Project

I am using android studio for app development and i am using it from its 1st release, i keep updating it whenever a patch is available.Recently I updated my android studio to latest version , that is 0.2.9 and now i am facing problem while creating new project.
every time i am getting this exception msg box
The following dependencies were not resolvable. See your build.gradle file for details.
- com.android.support:appcompat-v7:18.0.0
and i am clueless about what went wrong !!
p.s : previous projects are working fine
seeking suggestions on it :)
Make sure you download the Android Support Repository under Extras using the SDK Manager
The in your project module look for the second build.gradle file uncomment the dependencies section that is pointed in your case, the file provides some instruction on what you have to do.
With that in place save, build and test, happy coding!

Categories

Resources