Recently, I am trying to use LayaAir2 to export APP and convert H5 games into APP native applications. Encountered some problems, stuck me for 2 days. Now record these questions for the convenience of others.
Since I am using AndroidStudio for the first time, I am not familiar with many things. The big problem is actually concentrated in the environment configuration of AndroidStudio. At first, all my environments and plug-ins were downloaded with the latest version, but various errors were reported when compiling. For example, the error shown in the figure below is
took me a long time
> Task :app:processDebugManifest FAILED
Execution failed for task ':app:processDebugManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible:module java.base does not "opens java.io" to unnamed module @549b072c
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
The final conclusion is that the JDK, gradle version, and gradle plug-in version must be compatible with the project exported by Laya.
The version I finally installed is as follows: JDK1.8, gradle6.7.1, gradle plugin 4.2.2;
After the configuration is correct, start packaging, and encounter an error report, packaging failed.
Execution failed for task ':app:lintVitalRelease'.
The solution is to add in build.gradle :
lintOptions {
checkReleaseBuilds false
abortOnError false
}
In addition, some pits encountered when exporting Laya, also record them, so as not to forget
- When the Apk is opened, a code scanning interface is displayed
solution:
When building an app in Laya, do not use the default URL. The default URL is to display the above scanning interface. change to your own address
- Prompt " Failed to load the game, it may be because your network is unstable, please exit and re-enter "
This is because the resource path is not filled correctly. The path must be a directory at the same level as index.html, not the directory that is usually considered res