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.
I’m trying to extend my class from ActionBarActivity and cant, already tried every possible way I know. I’m importing android.support.v7.app.ActionBarActivity; I want to add the lib without the resource as instructed on the android developer’s site. And every time I get the same error....I upload some photos
this is the error: Description Resource Path Location Type
The project was not built since its build path is incomplete. Cannot find the class file for android.support.v4.app.ActionBarDrawerToggle$DelegateProvider. Fix the build path then try building this project xxx Unknown Java Problem
a busy cat http://img29.imageshack.us/img29/1032/qlei.jpg
a busy cat http://img43.imageshack.us/img43/6339/n4cj.jpg
thanks
The problem has been fixed for me after adding android support library.
Right Click -> Android Tools -> Add Support Library
Check that you have the android-support v7-appcompat project in the Projects tab on Java Build Path as in the picture:
(I can't add the picture to you, but you find it by right clicking your project and choose Build Path --> Configure Build Path)
Check also that that project does not report any error.
I am a novice but I just passed by the same obstacle a couple of minutes ago.
I hope this help.
I copied the whole project and it started working.....strange
I am currently migrating an Eclipse app to Android Studio.
This app was using the in app billing.
My main problem is to compile the project and the aidl file (I guess you all use this file)
I get this error message:
Gradle: error: cannot find symbol class IInAppBillingService
Gradle: error: package IInAppBillingService does not exist
So, following some tutorials, I move this file from com.mypackage.billing to src/main/aidl
(see this reference)
But as soon, as I do that, I get this message:
Gradle: Execution failed for task ':xxxxxxxxxxx:compileDebugAidl'.
Failed to run command:
(...) C:\Users\xxxx\AndroidStudioProjects\xxxxxxProject\xxxxxxx\src\main\aidl\IInAppBillingService.aidl:45
interface IInAppBillingService should be declared in a file called
com\xxxxxxxx\billing\IInAppBillingService.aidl.
The message is clearly a contradiction with the post from the Google bug page I linked above.
Anyone suceeded to make this aidl file to work and can help me?
Just to inform, some links I followed:
http://tools.android.com/tech-docs/new-build-system/user-guide
http://developer.android.com/guide/components/aidl.html
Adding this as an answer since it seemed to help quite a few people.
Create a new directory named 'aidl' under 'src/main/'. It should look like 'src/main/aidl'.
Add a new package name 'com.android.vending.billing' to the directory 'src/main/aidl'
Locate your sdk location and go to "sdk\extras\google\play_billing". Default location for the sdk is "C:\Program Files (x86)\Android\android-sdk". If you custom changed it, then you will have to figure out the location through the sdk manager.
Copy 'IInAppBillingService.aidl' into the package created above. In the end, it should look similar to the image below.
Rebuild project and it should be good to go.
Note: Make sure you include the necessary import if your reference isn't working
import com.android.vending.billing.IInAppBillingService;
https://issuetracker.google.com/issues/36973270
Edit From Comment
After I did this, the references to IInAppBillingService in my code were still highlighted as errors, but after rebuilding the app, the class was recognized
Just as the error message says, you need to put IInAppBillingService.aidl in the correct directory dictated by it's package (com.android.vending.billing).
Within the src/main/aidl/ folder you already have, put the .aidl file in com/android/vending/billing/.
Create new directory under src/main called aidl
Right click on directory aidl, select new->add package
Enter Name of the package com.android.vending.billing
Copy IInAppBillingService.aidl from the directory Android/Sdk/extras/google/play_billing to the directory App_name/app/src/main/aidl/com/android/vending/billing
Now go ahead with InApp billing coding and while defining InApp related services you will get an error can not resolve symbol IInAppBillingXXXXXX
Now goto to Build from android studio menu , click on Rebuild Project. This will generate IInAppBillingService.java file inside App_Name/app/build/generated/source/aidl/debug/com/android/vending/billing. This will solve the issue.
The rest of posts here didn't work for me till I created a new folder like shown here.
Add this code in build.gradle
android {
sourceSets {
main {
aidl.srcDirs = ['src']
}
}
}
Rebuild and import aidl class
The above answers concentrate on file location, but it appears you already had that set correctly. I experienced this same issue in Android Studio, but none of the listed answers resolved it, and I banged my head against it for an hour. Eventually, I realized that I was missing an obvious import:
import com.android.vending.billing.IInAppBillingService;
Once I added that it resolved this error message.
This import isn't mentioned in any of the Google Billing docs or included in any of the code examples that I found. While it may be obvious to experienced Java developers, beginners just trying to learn their first project may need it explicitly pointed out.
We need to add
create folder - src/main/aidl/packagename and place aidl file under this.
In the aidl file - mention the package name.
package packagename
Now clean the project, rebuild the project - We can the corresponding java file for the aidl generated in app\build\generated\source\aidl\debug\packagename\youraidl.java
I know it sounds so easy, but I copy paste from google sample all folder
https://github.com/googlesamples/android-play-billing/tree/master/TrivialDrive/app/src/main
aidl/com/android/vending/billing
copied into project aidl ( I had set project view in Android Studio)
and next I clean and rebuild project and it found a reference.
I've tried every solutions, but the problem was that Android Studio had compiled, with any apparent reason, in a different build type of the module that contains the AIDL packages than it was specified by the settings.
From debug to release, so the other modules couldn't see the AIDL pkg.
Switching from debug to release and turns back, solved my problem.
restarting Android Studio worked for me
a second silly thing that took me a while. I dropped the code on Android Studio to allow him create the file, but he created a .java (as expected) instead a .aidl Jiji, stupid of me
if you do all the names correct go to Build>rebuild project
it worked for me
I use Android Studio 4.1, just right click mouse -> New -> AIDL -> AIDL File.
A file will be created and placed in the [src/main/aidl] folder automatically. The aidl folder will also be created if it does not exist.
This function only supports min sdk 16+. My old project still can be supported, you can temporarily modify the min sdk to 16, create aidl and build project. After the relative interface and class be generated, recover the min sdk settings, it also works and builds project well then.
I am trying to setup an android Settings project on eclipse. I got it from the tablet manufaturer. So I need to setup that project on eclipse and need to make some changes to the settings. When I get this project into eclipse then i am getting some compilation errors as follows:
code is looking for this class android.os.SystemProperties,R.xml.accessibilitySettings
Please let me know how to compile this project properly.
Thanks
If you get errors like this, press Ctrl+ Shift + O in order to update the packages automatically.
Sometimes, you might have to add strings in res directory, in separate xml file called strings.xml
Try running simple examples from android samples package for better understanding
I am working on a custom Android library. I start off with a java project (in Eclipse) with another UI testing Android project.
In my UI testing project, I reference the library project in build path, and everything is good and I can test the library codes in the UI.
Later on, I decided I need to have the 'Gen' code (for custom styles attributes), so I try to change my library to an Android project (via Android-tools -> convert.. ), and disasters happens! After fixing up all the compile time problems, it finally 'let' me start the UI testing application, and bangs! When I try to create any objects from the library class, it said (in the Log) that Class not found.
Two questions:
Any idea how to fix this? I tried but seems it is for referencing another .apk that need to install separately.
If I just keep it to be java project (not android) for my library, can I use the resource generator? and how?
PS: the dependency (my library) is installed before the UI test application, according to the Console of Eclipse said.
Update: I tried to compile the library project to jar and reference it from the UI testing, and in this way, it works. But I don't want to use this approach since it is very slow in terms of testing.
for those who are doing same mistake like me
when library project is an android project
got to
properties > android > click add button at bottom of the popup inside
library section
and add project, instead of
properties > java build path > project > add
later approach is for pure java projects only .
Finally I found the answer to my own question. This is actually mentioned in official documentation.