android import error - android

I am trying use the GPE code for App-Android Android-App communication. Both the two new created folders (Android, AppEngine) have errors. I think the problem is that there are
errors with the packages:
import com.google.web.bindery.requestfactory.shared.InstanceRequest;
import com.google.web.bindery.requestfactory.shared.Request;
import com.google.web.bindery.requestfactory.shared.RequestContext;
import com.google.web.bindery.requestfactory.shared.RequestFactory;
import com.google.web.bindery.requestfactory.shared.ServiceName;
It says "The import com.google.web cannot be resolved." I tried adding everything able to be checked checked in the build path. I also know I installed the Web Toolkit and everything. What is wrong?
Statements like the following also have error markings:
#ProxyForName(value = "com.glm.server.Message",
locator = "com.glm.server.MessageLocator") and actually there are so many errors it must be the imports.

Related

GRPC for android: Import different protoc file

I'm using GRPC framework for my project. For example here is my sample directory structure for storing protoc file:
main
proto
model
user.proto
include
base.proto
I want to include base.proto into user.proto but I don't know how. I have tried some way to include that such as:
import "include/base.proto"
import "../include/base.proto".
But it doesn't work. I always receive error like:
import "include/base.proto" was not found or had errors.
Please help me figure out this problem.
The correct way should be:
import "include/base.proto";
gRPC uses that type of path in multiple tests.

how to import java.nio.file in android

I'm confused.Why okio cannot find this package in IDE and android cannot use this packgae based on 'How to use java.nio.file package in android?', but okio still works? How can I do this like okio?

Cannot find Log class in Android

I am developing an app in Android Studio with target for API 22. I have tried to use the Log class with the method d() but I did not find it. The helper shows only Log()...
What am I missing?
Just import the library import android.util.Log;
And just tips: use alt+space and alt+enter feature from Android Studio
Note:
Alt + Enter = Project quick fix (show intention actions and quick fixes)

Android Testing with Robolectric: not recognizing Facebook SDK

We are trying to use the Robolectric testing framework in Android Studio in order to test the Facebook API. The Facebook Login button works so the Facebook API is working. However, the following test fails:
package com.airportapp.test.Models;
import android.app.Activity;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
import org.robolectric.Robolectric;
import com.airportapp.test.MyRobolectricTestRunner;
import com.airportapp.LoginActivity;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
#RunWith(MyRobolectricTestRunner.class)
public class LoginActivityTest {
#Before
public void setup() {
//do whatever is necessary before every test
}
#Test
public void testActivityFound() {
Activity activity = Robolectric.buildActivity(LoginActivity.class).create().get();
Assert.assertNotNull(activity);
}
}
And the error is that Android Studio could not find the android.support file when we run the tests. You can see the error here:
The other error that shows up is:
android.view.InflateException: XML file app/src/main/res/layout/activity_login.xml line #-1 (sorry, not yet implemented): Error inflating class com.facebook.widget.LoginButton
So Android Studio is not happy with the facebook login button as well :( But it works... We think that we need to import something, but we don't know where to put it.
The InflateException is because Robolectric cannot find the resources from the Facebook SDK. To solve this, the project.properties file has to be updated to point to the Facebook SDK project. Do this by adding the following line to it:
android.library.reference.1={Path}
{Path} should be a relative path, from the project.properties file to the folder containing the AndroidManifest.xml of the Facebook SDK project. In my case that is ../../build/intermediates/exploded-aar/com.facebook.android/facebook/3.21.0.
Note that this works for all Android Library Projects which contain resources that aren't found by Robolectric. Further reading: here and here. Also, more documentation about project.properties can be found here. Note that in my project the Robolectric tests are located in the Android app project itself. So you could also try placing the project.properties file in the same directory as the AndroidManifest.xml used for testing.
As for your first problem; I have no personal experience with it. But it appears to be because Gradle cannot find the support libraries when compiling the unit tests. The answer from this question should fix it.

Android Wheel Data picker

I want to use android wheel to choose from some items. I just downloaded some library code from google. I am using it in my app, but it is giving some error.
import kankan.wheel.widget.OnWheelChangedListener;
import kankan.wheel.widget.OnWheelScrollListener;
import kankan.wheel.widget.WheelView;
import kankan.wheel.widget.adapters.AbstractWheelTextAdapter;
import kankan.wheel.widget.adapters.ArrayWheelAdapter;
Giving following error:
The import kankan.wheel.widget cannot be resolved
Can anyone tell me why this error is coming.
Thanks.
I have also used that library in my code and it is working fine.
possibility of error
You can't configure lib properly
In build path add lib
Clean eclipse.
Restart eclipse
import kankan.wheel.widget.OnWheelChangedListener;
import kankan.wheel.widget.OnWheelScrollListener;
import kankan.wheel.widget.WheelView;
import kankan.wheel.widget.adapters.NumericWheelAdapter;
WheelView wheel = getWheel(id);

Categories

Resources