Android Studio cannot resolve symbol utils when trying to migrate CSipSimple - android

I'm using CSipSimple. I followed the migration guide from Eclipse to Android Studio carefully and the only error that I am getting is
cannot resolve symbol utils
and is happening on below lines:
import com.actionbarsherlock.internal.utils.UtilityWrapper;
import com.csipsimple.R;
In build.gradle, I have added the following line:
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.android.support:support-v4:19.0.+'
}
Does anyone know why this would be happening? Any suggestion will be of great help.

ActionBarSherlock-4.4 does not have the package utils.
Check the version that was used before migrating to Android Studio.

VenomVendor's answer already provides the reason: there's no UtilityWrapper on ActionBarSherlock. So, I'll try to provide the fix instead.
tqcenglish has a GitHub repo for Android Studio port for CSipSimple. Its readme says:
Change
/res/values/wizard_sipgate_string.xml
<string xm:lns:ns0="http://schemas.android.com/tools" /> -
<resources xmlns:ns0="http://schemas.android.com/tools"/> +
delete jni folder
add jniLibs folder and org.pjsip.pjsua to java folder
delete about quote UtilityWrapper
Reference
com.actionbarsherlock:actionbarsherlock:4.4.0#aar
This seems to give a hint of removing any reference to UtilityWrapper, including import com.actionbarsherlock.internal.utils.UtilityWrapper;. However, it might compromise something.
You're on the right path to use com.actionbarsherlock:actionbarsherlock:4.4.0#aar for the dependency.
Alternatively, I don't see any reasons why files under utils won't work outside of com.actionbarsherlock.internal package, so you should be able to copy all files from com.actionbarsherlock.internal.utils to your java folder, then replace the import statement to use the corresponding package.

If you get this error while trying to use OpenCV, import this:
import org.opencv.android.Utils;

Related

Class symbol not recognized after module added

This is the library I am using. But I need to change the style java code. But since it's an external dependency, the file is read-only.
I learned here that if I add it as module I can then edit the file. I did that. I added the module successfully.
But now, the problem is how do I use the class from the library module. For instance, in my MainActivity.java, when I declared the global variable CarouselPicker carousel, Android Studio said 'Cannot resolve symbol CarouselPicker' and there is no Alt+Enter option to import any class. CarouselPicker is a class in the library. It worked when I used the library using compile in dependencies.
EDIT:
This is my Android file structure:
screenshot of Android file structure
This is the dependencies block code of my build.gradle(Module:app):
screenshot of code bloack
In my Share.java file, I tried to import CarouselPicker, this is what I get for Alt+Enter:
What Alt+Enter gave me.
please make sure that you have added the dependency line of the module in the gradle
see this for more details How to import class from another module in android studio?

How to import com.android.location.provider?

How I can import com.android.location.provider for creating custom unbundled location provider?
I use android studio and I import .jar file but it doesn't work .
in java code I wrote :
import com.android.location.provider.LocationProviderBase;
but It makes error and compiler can't reference to the library .
Finally I found the solution. Library com.android.location.provider.LocationProviderBase is not in public android API which is implemented in android.jar and can not be used easily.For referencing to this library you should use reflection in java and linking process occurs at runtime.
OR
You should get source of this package and manually add it to your project.
You need to set up Google Play services.
Follow following link to set up the google play service:
https://developers.google.com/android/guides/setup
Add following lines to you gradle file:
dependencies {
compile 'com.google.android.gms:play-services:9.2.0'
compile 'com.google.android.gms:play-services-location:9.2.0'
}
You can use following links for further information:
https://developer.android.com/training/location/index.html
http://www.vogella.com/tutorials/AndroidLocationAPI/article.html

Cannot import google cloud endpoints client library class in Android project

I'm having difficulty getting Google Cloud Endpoints working. I have an Python endpoints project running on GAE and it works perfectly using the api explorer. However I'm struggling to properly generate the client library and use it in my android app. I've tried a number of sample projects and have the same problem every time; I can't import and use the model classes from the client libraries.
Here's what I'm doing (for this example I'll use the helloworld api python sample at https://github.com/GoogleCloudPlatform/appengine-endpoints-helloendpoints-python)
Unzip the sample code
Generate the client library by navigating to folder and running
<gae-sdk>\endpointscfg.py get_client_lib java helloworld_api.HelloWorldApi
Unzip the generated folder and copy into root of project in eclipse
In Eclipse add "your_app_id_appspot_com-helloworld-v1-20140310110152-java-1.17.0-rc-sources.jar" to build path (Right click the JAR> Build Path>Add to Build Path)
At this stage, I can import com.appspot.your_app_id.helloworld.model.*but I cannot import com.appspot.your_app_id.helloworld.model.Greeting
Can anyone shed any light on what's happening here? I have tried many different ways to get this to work but have the same problem every time.
Many thanks,
Tom
The problem is that by default, the generated zip file only contains a sources jar, not an actual compiled library jar which your Android app can use.
Here's the solution:
In your backend api folder (from the same place where your app.yaml is located), generate the client library as a gradle library, like so:
<gae-sdk-path>\endpointscfg.py get_client_lib java -bs gradle helloworld_api.HelloWorldApi
You'll now have a helloworld-v1.zip. Unzip this (either right here or in somewhere convenient like ~/temp)
This will create a folder called helloworld, which should have a build.gradle in there along with a src folder.
Build your client library using "gradle install" in this folder.
Copy build/libs/helloworld-v1-1.X.X-SNAPSHOT.jar into your Android app's libs folder.
Add it as a library in Android Studio by right-click/add-as-library.
Your classes should now resolve correctly.
Step 4 should install the just-built client library into your local maven repository. You can follow the instructions in readme.html in the helloworld/ folder you extracted to integrate directly with your Android app's gradle build system instead of copying the jar your built manually.
This post said that there is a bug with Android Studio's Add As Library: Android Studio: IncorrectOperationException when 'Add as Library' is clicked whilst trying to configure Google Apps Endpoints client libraries
Not sure if it applies to Eclipse.
I was able to solve this problem and have provided the solution below.
I switched to Android Studio Preview 0.4.6 from Eclipse which helped get rid of some of Googles library import issues(through I guess build.gradle config). I feel it was not a problem of Eclipse which I was using earlier.
I was able to to fix the import issues. The code on the tutorial segments on the official Google docs needs to be put in sync.
The solution is to roughly do the following changes:
In MainActivity.java, replace:
HelloGreeting with HelloworldApiGreeting
In MainActivity.java, add the following at the top:
import android.widget.Toast;
import android.os.AsyncTask;
import android.util.Log
import com.appspot.androidbackend1.helloworld.model.HelloworldApiGreeting;
import com.appspot.androidbackend1.helloworld.model.HelloworldApiGreetingCollection;
In MainActivity.java, comment the following at the top:
import com.appspot.androidbackend1.helloworld.Helloworld.Greetings.Multiply;
import com.appspot.androidbackend1.helloworld.model.HelloGreeting;
In Application.java, add the following at the top:
import com.appspot.androidbackend1.helloworld.model.HelloworldApiGreeting;
In Application.java, replace:
HelloGreeting with HelloworldApiGreeting
Hope this saves time for others

android.support.v13.dreams.BasicDream cannot be resolved

I'm trying to work on extending BasicDream which exists in package: android.support.v13.dreams. I have tried downloading all most all android version (just trying luck to get it working) but I'm unable to import it. i.e. On
import android.support.v13.dreams.BasicDream; statement I'm getting an error:
The import xxxxxx... cannot be resolved.
I tried copying my sdk/extras/libs/../android-support-v13.jar in my libs folder and added to build path but found this package does not show dreams. While typing import statement I'm able to see v13 i.e. I can write import android.support.v13.app.*; but it does not have dreams/basicdream.
Tried google and do found the source code of this class but no idea why my jar file does not have these classes or how to use it. Please suggest what am I missing here.
Update: Finally I figured out that BasicDream was part of Android Support Library version 13 Link: BasicDream source codeshipped with android 4.1.2 however latest Android Support Library version 13 does not have Basic Dream.support library v13 class list
As I'm working on some native functionality, I downloaded BasicDream source code from the link mentioned above and included in same folder where I have my other source files. Updated the package to my application package
In your case probably the best way to get it is to check code of this class on GrepCode and manually resolve (copy) all dependencies. Good luck!

Where can I get a JAR to import libcore.io?

I want to handle an GaiException in my App. The debugger tells me, it lives in the libcore.io package, but importing it yields an error. I guess I need to add an additional JAR to my projct to correctly resolve this type. I've been digging a bit in my android sdk folder, but don't seem to find anything of the kind.
Thanks for any advice.
If you are using android studio you can add this line to your gradle build (under dependencies).
compile 'org.robovm:robovm-rt:+'
If using Eclipse, check this Maven link and add it however is appropriate.

Categories

Resources