我有一个基于的Xamarin项目MvvmCross.该项目适用于iOS和Android.我在Visual Studio 15中打开了这个项目.我遇到了一些错误,我很快就解决了.有一些错误,即使在Google和Stackoverflow上搜索后也无法解决.我已经尝试了在Stackoverflow上找到的每个方法,但仍然存在所有剩余的错误.这个项目正在使用像RestSharp和BoxApi.V2这样的第三方库(更多)
我在下面发布我的错误日志.
Severity Code Description Project File Line Suppression State
Error The "ResolveLibraryProjectImports" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'RestSharp(Android), Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'RestSharp(Android).dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() BoxApi.V2 (Android)
Run Code Online (Sandbox Code Playgroud)
此解决方案中包含的所有项目都会重复此错误.所以我多次收到此错误.
我还想补充说,该项目以前是在MAC上构建的,而我正在使用Windows,这是否会产生一些兼容性或跨操作系统问题?我已检查所有装配参考,所有工作正常.
当我的一些数据添加到"列表模式"并恢复已保存的数据旋转装置上,不幸的是还原后的数据和设置此代码工作正常model范围内onRestoreInstanceState的方法,增加其他数据到后,适配器无法与新添加的数据,数据刷新可以更新后适配器中的源,但适配器可以; t知道它们,我正在使用MVVM数据模型绑定并搜索更多关于此问题的时间我无法解决这个问题.
Rhat有一个简单的提示,在再次旋转设备后,我的适配器可以刷新所有添加的数据,适配器不用它们刷新.
public class ActivityRegister extends BaseActivities{
private List<RobotViewModel> model = new ArrayList<>();
...
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
}
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putParcelable("model", Parcels.wrap(model));
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle outState) {
model = Parcels.unwrap(outState.getParcelable("model"));
adapter.setData(model);
adapter.notifyItemInserted(model.size() - 1);
binding.registerRobot.scrollToPosition(adapter.getItemCount() - 1);
}
Run Code Online (Sandbox Code Playgroud)
添加到model方法:
@Override
public void clickOnSendCommandToRobot() {
RobotViewModel temp = new RobotViewModel();
temp.setMessage("message");
temp.setCommand(true);
model.add(temp);
adapter.notifyItemInserted(model.size() - …Run Code Online (Sandbox Code Playgroud) 我已经实现了firebase的推送.
我正在发送通知,但我的状态为"失败".当我向所有设备发送通知时,它标记为已完成,但我仍未收到设备中的消息.
即使我向单个设备发送消息,它也会显示失败,并且不会在设备上收到通知.
代码是
private static final String TAG = "StartingAndroid";
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
//It is optional
Log.e(TAG, "From: " + remoteMessage.getFrom());
Log.e(TAG, "Notification Message Body: " + remoteMessage.getNotification().getBody());
//Calling method to generate notification
sendNotification(remoteMessage.getNotification().getTitle(),remoteMessage.getNotification().getBody());
}
//This method is only generating push notification
private void sendNotification(String title, String messageBody) {
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,
PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle(title)
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri) …Run Code Online (Sandbox Code Playgroud) 我正在尝试将状态栏的颜色更改为带有灰色图标的白色.我已经为这个问题尝试了几乎所有的代码解决方案,但是没有为我工作.
我正在使用这个java fucntion来改变它,我也发布了我的样式(21)代码.
public static void statusBarColor(Window window, Context ctx) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//Window window = getActivity().getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(ctx.getResources().getColor(R.color.statusbar_color));
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的java代码,但它在千万次尝试后无法正常工作.以下是我的style.xml(21)
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="23">true</item>
</style>
Run Code Online (Sandbox Code Playgroud)
如果你认为它的一些其他问题的副本,那么我现在应该让你尝试3,4页谷歌搜索并实施它们.
android statusbar android-layout android-view material-design
随着 android 不断提高其安全性并不断改变一些东西,以使 Android 操作系统对漏洞更安全,因此了解开发人员进入它的新结构是一件好事。最近几年我一直在远离开发。我只是注意到一些东西已经改变,例如 URI 的文件方案。
案例 1 ::我正在使用下面提到的自定义 URI 启动相机意图。
var takePictureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
// Ensure that there's a camera activity to handle the intent
if (takePictureIntent.resolveActivity(packageManager) != null) {
// Create the File where the photo should go
var photoFile: File? = null
try {
photoFile = createImageFile()
} catch (ex: IOException) {
// Error occurred while creating the File
}
// Continue only if the File was successfully created
if (photoFile != null) {
val …Run Code Online (Sandbox Code Playgroud) 我正在fullCalendar中实现listMonth.我想颠倒顺序,首先在最近的事件之上显示,而不是在底部.我该怎么做?
android ×4
android-view ×1
c# ×1
firebase ×1
fullcalendar ×1
mvvm ×1
mvvmcross ×1
statusbar ×1
xamarin ×1