-
Notifications
You must be signed in to change notification settings - Fork 564
MAUI project with non-ASCII project name cannot release to my Android phone #7710
New issue
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
Changes from all commits
dbff49c
48142ff
193bfdf
5c1347f
994d429
b814bd4
b4dd26c
80ae6d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| --- | ||
| title: Xamarin.Android error APT2265 | ||
| description: APT2265 error code | ||
| ms.date: 12/16/2022 | ||
| --- | ||
| # Xamarin.Android error APT2265 | ||
|
|
||
| ## Issue | ||
|
|
||
| The tool `aapt2` is unable to resolve one of the files it was passed. | ||
| This is generally caused by non-ASCII characters in the project name | ||
| or the path to the project. | ||
|
|
||
| ## Solution | ||
|
|
||
| The best way to avoid this is to ensure that your project does not contain | ||
| non-ASCII characters. | ||
| For example if you create all of your projects in folders such as | ||
|
|
||
| `C:\Users\shëlly\Visual Studio 2022\Android\MyProjects\Com.SomeReallyLongCompanyName.MyBrillantApplication\MyBrilliantApplicaiton.Android\` | ||
|
|
||
| you may well encounter problems with not only `aapt2` but also Ahead of Time | ||
| compilation. Keeping your project names and folder structures short, concise and | ||
| ASCII will help work around these issues. For example instead of the above | ||
| you could use | ||
|
|
||
| `C:\Work\Android\MyBrilliantApp` | ||
|
|
||
| Which is much shorter, contains no non-ASCII characters and much less likely to encounter issues. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,6 +112,38 @@ public void BuildBasicApplicationReleaseProfiledAotWithoutDefaultProfile () | |
| StringAssertEx.DoesNotContainRegex (@$"Using profile data file.*{filename}\.aotprofile", b.LastBuildOutput, "Should not use default AOT profile", RegexOptions.IgnoreCase); | ||
| } | ||
|
|
||
| [Test] | ||
| [TestCase ("テスト", false, false, true)] | ||
| [TestCase ("テスト", true, true, false)] | ||
| [TestCase ("テスト", true, false, true)] | ||
| [TestCase ("随机生成器", false, false, true)] | ||
| [TestCase ("随机生成器", true, true, false)] | ||
| [TestCase ("随机生成器", true, false, true)] | ||
| [TestCase ("中国", false, false, true)] | ||
| [TestCase ("中国", true, true, false)] | ||
| [TestCase ("中国", true, false, true)] | ||
| public void BuildAotApplicationWithSpecialCharactersInProject (string testName, bool isRelease, bool aot, bool expectedResult) | ||
| { | ||
| if (!IsWindows) | ||
| expectedResult = true; | ||
| var rootPath = Path.Combine (Root, "temp", TestName); | ||
| var proj = new XamarinAndroidApplicationProject () { | ||
| ProjectName = testName, | ||
| IsRelease = isRelease, | ||
| AotAssemblies = aot, | ||
| }; | ||
| proj.SetAndroidSupportedAbis ("armeabi-v7a", "arm64-v8a", "x86", "x86_64"); | ||
| using (var builder = CreateApkBuilder (Path.Combine (rootPath, proj.ProjectName))){ | ||
| builder.ThrowOnBuildFailure = false; | ||
| Assert.AreEqual (expectedResult, builder.Build (proj), "Build should have succeeded."); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this also verify the build error?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
| if (!expectedResult) { | ||
| var aotFailed = builder.LastBuildOutput.ContainsText ("Precompiling failed"); | ||
| var aapt2Failed = builder.LastBuildOutput.ContainsText ("APT2265"); | ||
| Assert.IsTrue (aotFailed || aapt2Failed, "Error APT2265 or an AOT error should have been raised."); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| static object [] AotChecks () => new object [] { | ||
| new object[] { | ||
| /* supportedAbis */ "arm64-v8a", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.