There is a project and its source code lies in main/java/example . There is also a code in the main/java/com folder. In com source code of the library.

Here, in the directory where R classes are created, the R class is created in the example folder, and the com folder does not appear with the R class. And it should, since the code has an import of this class. If to connect aar library through dependences this R class appears.

Well, I think I need to dig starting with the question:

At what point is the R class being created, maybe you need to add a record somewhere? So far I have just copied the R class that appears when the library is connected, but then it should appear as it is.

UPD

Copying the R class does not help, when you start the application, it is deleted. Why I need this class, I know very superficially, until I understand it and this is not the crux of the matter. I need an answer to how I create it. And I will deal with the meaning later

UPD1 On the way AndroidStudioProjects\app\src\main\java\example\i lay the code of my project. The library code was added along the path AndroidStudioProjects\app\src\main\java\com\vk\sdk . No matter what library it is. I tried to add different libraries, but the R class is created only for the code lying along the path AndroidStudioProjects\app\src\main\java\example\i And naturally swears at the absence of the import com.vk.sdk.R; class import com.vk.sdk.R; and everything like findViewById(R.id.captchaAnswer); highlighted in red, because no resource identifiers.
The UPD2 folder where the R classes appear is C:\Android\AndroidStudioProjects\AndroidStudioProjects\app\build\generated\source\r\debug If you hook up the library through dependencies, the R class will appear. I cut it. I disconnect dependences. I insert the cut class. But when you start the application, it is deleted. Those. where it is. An indication for which code the R class is created.

Cleaned the project, cache and rebuild tried.

UPD3 If we reformulate the question shorter, then R.class not created for other package that are in the src\main\java\ folder, except for the first package created

  • Show how your library is connected in both cases. - Yuriy SPb
  • In a case when the library is connected through dependences there is no problem. I just want to merge java files of my project with java library files. dependencies {compile (name: 'androidsdk-1.6.3', ext: 'aar')} I need to experiment with one class of this library, I need to edit its code. - Turalllb
  • I think you need to connect either as a module. So you can edit her code - YuriySPb
  • What is wrong with simply merging the library code with the project code? As a module, it did not connect with me. True, I saved the code in another package - Turalllb
  • Well, at least then, to be comfortable and correct. If you need to test live, connect it as a project. If it is not needed - just delete one line. If needed, leave it as it is or change the string to a dependency on the aar file. It's much easier than to embed a lot of code, resolve conflicts, and then also cut it all back - YuriiSPb

0