Search Issue Tracker
By Design
Votes
0
Found in
2019.2.21f1
2019.3
2020.2
Issue ID
1222402
Regression
No
[Android] Could not find error is thrown when exporting Unity project as a native Android application
Reproduction steps:
1. Open the user-submitted project
2. Export the project as a native Android application
3. Open the project in Android Studio
4. Build the project
Expected result: Build is successful
Actual result: Build fails
Reproduces on: 2019.3.7f1, 2020.1.0b3, 2020.2.0a4
Notes:
The build is successful when building with Unity versions 2019.2.21f1 and below.
Could not test with Unity versions 2019.3.0a5 and below due to Failed to apply plugin [id 'com.android.library'] error.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Prefab Override popup displays on wrong monitor when Inspector width is resized to minimum
- Scroll View is not moving by inertia after scrolling by click and dragging when Editor window is minimized and Canvas "Render Mode" is set to "World Space"
- "type mismatch error" occurs when the currentDirectionWS output of a Sample Water Surface node is connected to a float3 input
- URP Material Upgrade utility does not enable Alpha Clipping when material had Rendering Mode set to Cutout
- Particle System emission ignores the Sprite Atlas when using a Material that has the "Include in Build" setting unchecked
Resolution Note (2020.2.X):
A little bit of context:
Unity 2019.3 introduced feature called Unity as a Library (UaaL). To implement this feature, it was necessary to separate exported Android project into two modules: launcher and unitylibrary. So the new project structure now contains its build.gradle file and these two modules each of which contains its own build.gradle file.
Files paths are:
root: exported-project/build.gradle
launcher: exported-project/launcher/build.gradle
unitylibrary: exported-project/unitylibrary/build.gradle
So what is happening:
Provided repro project contains custom mainTemplate.gradle file where user defined additional project settings (repositories in this case). If Unity 2019.3 (or later) is used to export AndroidStudio project this gradle file will be used to create unitylibrary build.gradle file. If launcher module requires these dependencies as well building project will fail (as it does now).
So what can be done:
1 (Recommended) method: Update Unity to at least 2019.3.7f1 version. From this version Unity allows to replace any of build.gradle files mentioned above. Then replace root build.gradle file with custom one and add there all dependencies that are required by both modules. If user needs to modify other build.gradle files, he can do that as well.
Note: In this case I would recommend to export project without custom files first. This will generate default ones. Then put everything necessary for the project and use result as custom build.gradle file.
2 (workaround) method: Current mainTemplate.gradle file could be modified by putting repositories declaration into rootProject.allprojects scope like this:
rootProject.allprojects { repositories { user stuff } }. Although this will be defined in unitylibrary module, rootProject.allprojects will ensure that defined repositories will be available to all modules.