I
I
IvaToa102019-11-03 18:32:04
Java
IvaToa10, 2019-11-03 18:32:04

What is available from c++ code in android app?

Good afternoon!

The situation is this - there is an Android application with a c++ library (.so file). You need to use this library in another application without changing the code to c++.

If you create an application, describing all the functions for accessing the c ++ library in java code and applicationId in gradle and package in AndroidManifest with the name of the first application, then everything works.

But if you also describe all the functions for accessing the c ++ library in java code, but change the applicationId in gradle and package in AndroidManifest to another, then some of the functions do not work.

Note - naturally I don't change the package name in the java code so that the Java_com_package_name c++ functions work.

My thoughts.
There is a native function that is passed context.
Perhaps you need to somehow use the context from the first application. There is a method - createPackageContext().

1. Can you please explain how it works?

2. How can context be used in c++ code, what can it cause? Perhaps you just need to override these methods in the java class and everything will work.

3. What can be accessed from c++ code to an Android application? As I understand it, it can call java functions and have access to assets. What else does he have access to?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question