GRPC for android: Import different protoc file - android

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.

Related

How to change android package name in React native 0.70 and above

I've came up with this problem as in my recent project in which I'm using react native 0.70, I need to change the android package name and all the solutions which I found were on pervious versions but the structure changed a little in React native 0.70 so I was getting errors
I tried many solutions which were provided many they were telling to change these files
android/app/src/main/java/yourApp/MainActivity.java
android/app/src/main/java/yourApp/MainApplication.java
android/app/src/main/AndroidManifest.xml
android/app/build.gradle
android/app/Buck:
So I've found the solution to this and sharing it here so if anyone going through the same can get help from this
As the structure has changed a little in react native 0.70 we need to make changes in some extra files also
So these are the changes which we need to make, i'ive used newApp but you've to use your package name there
In:android/app/src/main/java/yourApp/MainActivity.java:
package com.newApp
In:android/app/src/main/java/yourApp/MainApplication.java:
package com.newApp
In: android/app/src/main/AndroidManifest.xml:
package="com.newApp"
In: android/app/build.gradle:
applicationId "com.newApp"
In:android/app/_BUCK:
android_build_config(
package="com.newApp"
)
android_resource(
package="com.newApp"
)
In: android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h
static constexpr auto kJavaDescriptor =
"Lcom/newApp/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;";
In: android/app/src/main/jni/MainComponentsRegistry.h
constexpr static auto kJavaDescriptor =
"Lcom/yournewpackagename/newarchitecture/components/MainComponentsRegistry;";
In:android/app/src/main/java/yourApp/newarchitecture/MainApplicationReactNativeHost.java: make changes in these 4 lines
package com.newApp.newarchitecture;
import com.newApp.BuildConfig;
import com.newApp.newarchitecture.components.MainComponentsRegistry;
import com.newApp.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate;
In:android/app/src/main/java/yourApp/newarchitecture/components/MainComponentsRegistry.java:
package com.newApp.newarchitecture.components;
In:android/app/src/main/java/yourApp/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java:
package com.newApp.newarchitecture.modules;
after these steps just clean your project by typing this in your project terminal
cd android
./gradlew clean
now just go back and run your project and it would be a good approach to use android studio to run it for the first time
How to change android package name com.companyname.appname

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?

Using Arcanimator in android app

Hi i want to use ArcAnimator and ArcLayout in one android project .
for that i using this dependencys
compile 'com.ogaclejapan.arclayout:library:1.0.1#aar'
compile 'com.github.asyl.animation:arcanimator:1.0.0'
but i give this error message
cannot resolve symbol'SupportAnimator'
cannot resolve symbol'ViewAnimationUtils'
in import line
import io.codetail.animation.SupportAnimator;
import io.codetail.animation.ViewAnimationUtils;
and its strange because i do not give this error in this lines
import io.codetail.animation.arcanimator.ArcAnimator;
import io.codetail.animation.arcanimator.Side;
which is in same library.
can anyone help me about that?
You have to use other dependency to use Support Animator say https://github.com/kedzie/Support_v4_NineOldAndroids. Support Animator is not there in the package of the library that you have used. It’s not showing inside the package you have used, you can check at https://github.com/asyl/ArcAnimator/tree/master/animator/src/main/java/io/codetail/animation/arcanimator.
Also you can take help of some samples given here at https://github.com/ozodrukh/CircularReveal/releases.

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 import error

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.

Categories

Resources