繁体   English   中英

将Firebase广告添加到Xamarin.Forms会导致:名称不能以'$'字符开头,十六进制值为0x24

[英]Adding Firebase Ads to Xamarin.Forms causes: Name cannot begin with the '$' character, hexadecimal value 0x24

仅Windows仅在使用相同解决方案的Mac上不会发生此错误。

将Firebase广告添加到Xamarin.Forms的原因:名称不能以'$'字符开头,十六进制值0x24 Visual Studio将此显示为警告,但实际上已在构建过程中停止。

1>DccClassCancelations.Android -> D:\dev\DccClassCancelationsLite\DccClassCancelations\DccClassCancelations\DccClassCancelations.Android\bin\Debug\DccClassCancelations.Android.dll 
1>No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily. 
1>Name cannot begin with the '$' character, hexadecimal value 0x24. 
1>C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.3\zipalign.exe 4 "D:\dev\DccClassCancelationsLite\DccClassCancelations\DccClassCancelations\DccClassCancelations.Android\obj\Debug\android\bin\com.JacobErnst.DccClassCancelations.apk" "bin\Debug\\com.JacobErnst.DccClassCancelations-Signed.apk"  
1>C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.3\apksigner.BAT sign --ks "C:\Users\jacob\AppData\Local\Xamarin\Mono for Android\debug.keystore" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android --min-sdk-version 15 --max-sdk-version 27  bin\Debug\com.JacobErnst.DccClassCancelations-Signed.apk  
1>"apksigner.BAT" exited with code 2. 
1>Done building project "DccClassCancelations.Android.csproj" -- FAILED. 
1>Build FAILED. 
1> 
1>Deploy failed on NExus6 ========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

Visual Studio解决方案中没有文件的名称以“ $”开头

重现步骤

  1. 新建一个Xamarin.Forms项目
  2. 从NuGet安装Xamarin.Firebase.Ads包
  3. 构建Android项目

1>Name cannot begin with the '$' character, hexadecimal value 0x24. 不应破坏您的代码。 (诚​​然,我已经无视这个错误了好几周了,编译也没有问题)。

从您的输出中,我认为问题是因为1>"apksigner.BAT" exited with code 2.从经验来看,由于应用程序大小,我遇到了类似的问题。 Android包含65k种方法,包括Google Services时很容易满足。 解决方案是启用multidex。

总而言之, Name cannot begin with the '$' character应该不会导致致命错误,但是如果我以前的建议不起作用,我建议您考虑重新命名mscorlib(但同样不太可能成为问题的根源),然后您的签名过程(没有适当的详细信息,我无法在此处提供解决方案,但是,如果不终止构建,则在对apk进行签名时发生的错误至少会使您的应用崩溃),因为

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM