Skip to content

Commit 50467c4

Browse files
authored
Fix Android issue (Could not load the file 'System.Private.Corelib') (#466)
1 parent ca0c4f9 commit 50467c4

34 files changed

+14553
-2
lines changed

System.Linq.Dynamic.Core.sln

+48
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Z.Dynamic.Core.Lab", "Z.Dyn
9696
EndProject
9797
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.EntityFrameworkCore.DynamicLinq.EFCore3", "src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore3\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore3.csproj", "{7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}"
9898
EndProject
99+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src-android", "src-android", "{F5534C59-3A41-4A33-9E43-5CE0082A957F}"
100+
EndProject
101+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestSLDC", "src-android\TestSLDC\TestSLDC.csproj", "{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}"
102+
EndProject
103+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestSLDC.Android", "src-android\TestSLDC.Android\TestSLDC.Android.csproj", "{85D70423-5800-41E9-B7D5-244AAF051A85}"
104+
EndProject
99105
Global
100106
GlobalSection(SolutionConfigurationPlatforms) = preSolution
101107
Debug|Any CPU = Debug|Any CPU
@@ -526,6 +532,46 @@ Global
526532
{7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Release|x64.Build.0 = Release|Any CPU
527533
{7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Release|x86.ActiveCfg = Release|Any CPU
528534
{7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Release|x86.Build.0 = Release|Any CPU
535+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
536+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
537+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Debug|ARM.ActiveCfg = Debug|Any CPU
538+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Debug|ARM.Build.0 = Debug|Any CPU
539+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Debug|x64.ActiveCfg = Debug|Any CPU
540+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Debug|x64.Build.0 = Debug|Any CPU
541+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Debug|x86.ActiveCfg = Debug|Any CPU
542+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Debug|x86.Build.0 = Debug|Any CPU
543+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
544+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Release|Any CPU.Build.0 = Release|Any CPU
545+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Release|ARM.ActiveCfg = Release|Any CPU
546+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Release|ARM.Build.0 = Release|Any CPU
547+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Release|x64.ActiveCfg = Release|Any CPU
548+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Release|x64.Build.0 = Release|Any CPU
549+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Release|x86.ActiveCfg = Release|Any CPU
550+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8}.Release|x86.Build.0 = Release|Any CPU
551+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
552+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|Any CPU.Build.0 = Debug|Any CPU
553+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
554+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|ARM.ActiveCfg = Debug|Any CPU
555+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|ARM.Build.0 = Debug|Any CPU
556+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|ARM.Deploy.0 = Debug|Any CPU
557+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|x64.ActiveCfg = Debug|Any CPU
558+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|x64.Build.0 = Debug|Any CPU
559+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|x64.Deploy.0 = Debug|Any CPU
560+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|x86.ActiveCfg = Debug|Any CPU
561+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|x86.Build.0 = Debug|Any CPU
562+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|x86.Deploy.0 = Debug|Any CPU
563+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Release|Any CPU.ActiveCfg = Release|Any CPU
564+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Release|Any CPU.Build.0 = Release|Any CPU
565+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Release|Any CPU.Deploy.0 = Release|Any CPU
566+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Release|ARM.ActiveCfg = Release|Any CPU
567+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Release|ARM.Build.0 = Release|Any CPU
568+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Release|ARM.Deploy.0 = Release|Any CPU
569+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Release|x64.ActiveCfg = Release|Any CPU
570+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Release|x64.Build.0 = Release|Any CPU
571+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Release|x64.Deploy.0 = Release|Any CPU
572+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Release|x86.ActiveCfg = Release|Any CPU
573+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Release|x86.Build.0 = Release|Any CPU
574+
{85D70423-5800-41E9-B7D5-244AAF051A85}.Release|x86.Deploy.0 = Release|Any CPU
529575
EndGlobalSection
530576
GlobalSection(SolutionProperties) = preSolution
531577
HideSolutionNode = FALSE
@@ -557,6 +603,8 @@ Global
557603
{CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8} = {122BC4FA-7563-4E35-9D17-077F16F1629F}
558604
{CDD8D5BF-A212-43DD-B043-4B7242C553E0} = {E97833C1-77B6-44E2-8793-C1F952CA936F}
559605
{7994FECC-965C-4A5D-8B0E-1A6EA769D4BE} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F}
606+
{EEF1D4FB-8DFD-4CC7-ABD9-808A7BB4ECD8} = {F5534C59-3A41-4A33-9E43-5CE0082A957F}
607+
{85D70423-5800-41E9-B7D5-244AAF051A85} = {F5534C59-3A41-4A33-9E43-5CE0082A957F}
560608
EndGlobalSection
561609
GlobalSection(ExtensibilityGlobals) = postSolution
562610
SolutionGuid = {94C56722-194E-4B8B-BC23-B3F754E89A20}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Any raw assets you want to be deployed with your application can be placed in
2+
this directory (and child directories) and given a Build Action of "AndroidAsset".
3+
4+
These files will be deployed with your package and will be accessible using Android's
5+
AssetManager, like this:
6+
7+
public class ReadAsset : Activity
8+
{
9+
protected override void OnCreate (Bundle bundle)
10+
{
11+
base.OnCreate (bundle);
12+
13+
InputStream input = Assets.Open ("my_asset.txt");
14+
}
15+
}
16+
17+
Additionally, some Android functions will automatically load asset files:
18+
19+
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
3+
using Android.App;
4+
using Android.Content.PM;
5+
using Android.Runtime;
6+
using Android.Views;
7+
using Android.Widget;
8+
using Android.OS;
9+
10+
namespace TestSLDC.Droid
11+
{
12+
[Activity(Label = "TestSLDC", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
13+
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
14+
{
15+
protected override void OnCreate(Bundle savedInstanceState)
16+
{
17+
TabLayoutResource = Resource.Layout.Tabbar;
18+
ToolbarResource = Resource.Layout.Toolbar;
19+
20+
base.OnCreate(savedInstanceState);
21+
22+
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
23+
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
24+
LoadApplication(new App());
25+
}
26+
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
27+
{
28+
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
29+
30+
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
31+
}
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.testsldc">
3+
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
4+
<application android:label="TestSLDC.Android" android:theme="@style/MainTheme"></application>
5+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
using Android.App;
5+
6+
// General Information about an assembly is controlled through the following
7+
// set of attributes. Change these attribute values to modify the information
8+
// associated with an assembly.
9+
[assembly: AssemblyTitle("TestSLDC.Android")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("TestSLDC.Android")]
14+
[assembly: AssemblyCopyright("Copyright © 2014")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
[assembly: ComVisible(false)]
18+
19+
// Version information for an assembly consists of the following four values:
20+
//
21+
// Major Version
22+
// Minor Version
23+
// Build Number
24+
// Revision
25+
[assembly: AssemblyVersion("1.0.0.0")]
26+
[assembly: AssemblyFileVersion("1.0.0.0")]
27+
28+
// Add some common permissions, these can be removed if not needed
29+
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
30+
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Images, layout descriptions, binary blobs and string dictionaries can be included
2+
in your application as resource files. Various Android APIs are designed to
3+
operate on the resource IDs instead of dealing with images, strings or binary blobs
4+
directly.
5+
6+
For example, a sample Android app that contains a user interface layout (main.xml),
7+
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8+
would keep its resources in the "Resources" directory of the application:
9+
10+
Resources/
11+
drawable-hdpi/
12+
icon.png
13+
14+
drawable-ldpi/
15+
icon.png
16+
17+
drawable-mdpi/
18+
icon.png
19+
20+
layout/
21+
main.xml
22+
23+
values/
24+
strings.xml
25+
26+
In order to get the build system to recognize Android resources, set the build action to
27+
"AndroidResource". The native Android APIs do not operate directly with filenames, but
28+
instead operate on resource IDs. When you compile an Android application that uses resources,
29+
the build system will package the resources for distribution and generate a class called
30+
"Resource" that contains the tokens for each one of the resources included. For example,
31+
for the above Resources layout, this is what the Resource class would expose:
32+
33+
public class Resource {
34+
public class drawable {
35+
public const int icon = 0x123;
36+
}
37+
38+
public class layout {
39+
public const int main = 0x456;
40+
}
41+
42+
public class strings {
43+
public const int first_string = 0xabc;
44+
public const int second_string = 0xbcd;
45+
}
46+
}
47+
48+
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
49+
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
50+
string in the dictionary file values/strings.xml.

0 commit comments

Comments
 (0)