We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ok, so i had this two issues.
Both fixed in Build.cs . In comments after // ... it is version which was before changes!
public static void DoBuildAndroid() { string buildPath = Path.Combine(apkPath); // -not working version Path.Combine(apkPath, Application.productName); string exportPath = Path.GetFullPath(Path.Combine(ProjectPath, "../../android/UnityExport"));
if (Directory.Exists(apkPath)) Directory.Delete(apkPath, true); if (Directory.Exists(exportPath)) Directory.Delete(exportPath, true); EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle; var options = BuildOptions.AcceptExternalModificationsToPlayer; var report = BuildPipeline.BuildPlayer( GetEnabledScenes(), apkPath, BuildTarget.Android, options ); if (report.summary.result != BuildResult.Succeeded) throw new Exception("Build failed"); Copy(buildPath, exportPath); // Modify build.gradle var build_file = Path.Combine(exportPath, "build.gradle"); var build_text = File.ReadAllText(build_file); build_text = build_text.Replace("com.android.application", "com.android.library"); build_text = build_text.Replace("implementation fileTree(dir: 'libs', include: ['*.jar'])", "api fileTree(include: ['*.jar'], dir: 'libs')"); // build_text = build_text.Replace("implementation(name: 'VuforiaWrapper', ext:'aar')", "api(name: 'VuforiaWrapper', ext: 'aar')"); build_text = Regex.Replace(build_text, @"\n.*applicationId '.+'.*\n", "\n"); File.WriteAllText(build_file, build_text); // Modify AndroidManifest.xml var manifest_file = Path.Combine(exportPath, "unityLibrary/src/main/AndroidManifest.xml"); // -not working version, missed 'unityLibrary/' + src/main/AndroidManifest.xml"); var manifest_text = File.ReadAllText(manifest_file); manifest_text = Regex.Replace(manifest_text, @"<application .*>", "<application>"); Regex regex = new Regex(@"<activity.*>(\s|\S)+?</activity>", RegexOptions.Multiline); manifest_text = regex.Replace(manifest_text, ""); File.WriteAllText(manifest_file, manifest_text); }
Cheers!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Ok, so i had this two issues.
Both fixed in Build.cs . In comments after // ... it is version which was before changes!
public static void DoBuildAndroid()
{
string buildPath = Path.Combine(apkPath); // -not working version Path.Combine(apkPath, Application.productName);
string exportPath = Path.GetFullPath(Path.Combine(ProjectPath, "../../android/UnityExport"));
Cheers!
The text was updated successfully, but these errors were encountered: