我已经下载了一些库源,并希望使用Android Studio将其导出为Jar文件.有没有办法使用Android工作室导出到jar文件?
编辑:
我想导出为jar的库是一个Android库.它被称为"StandOut",可以从GitHub下载. https://github.com/pingpongboss/StandOut
VS Code 上的 [pwsh] 和 [Powershell 集成控制台] 有什么区别?
我通常使用 pwsh。
今天,当我安装powershell扩展然后尝试更新powershell时,Powershell集成控制台启动并发现。这是什么???
我的 Powershell v5.1 几乎不会自动安装任何模块,install-module而手动安装确实有效。
首先,当我运行时install-module,它会下载模块然后抛出一个错误,比如 pscx 模块:
PackageManagement\Install-Package : Package 'Pscx' failed to be installed because: Specified cast is not valid.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.0.4\PSModule.psm1:9307 char:21
+ ... $null = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (Pscx:String) [Install-Package], Exception
+ FullyQualifiedErrorId : Package '{0}' failed to be installed because: {1},Microsoft.PowerShell.PackageManag
ement.Cmdlets.InstallPackage
Run Code Online (Sandbox Code Playgroud)
我现在能做的就是手动下载模块并import-module自己使用。当我尝试通过此 cmdlet 安装任何模块时,几乎每次都会发生该错误。我该如何解决这个问题?
对于故障排除,Get-PSRepository给我这个:
PS C:\> Get-PSRepository
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Trusted https://www.powershellgallery.com/api/v2
GalleryRolling Trusted https://www.poshtestgallery.com/api/v2/
Run Code Online (Sandbox Code Playgroud)
编辑: …
如果你拆分 a string,你会得到一个string[]。
$foo = "apple,banana,coconut"
Write-Output $foo.GetType()
$foo = $foo -split ","
Write-Output $foo.GetType()
Run Code Online (Sandbox Code Playgroud)
如果你拆分一个参数化的string,你会得到一个string.
Function Get-Foo() {
param (
[string] $foo
)
Write-Output $foo.GetType()
$foo = $foo -split ","
Write-Output $foo.GetType()
}
Run Code Online (Sandbox Code Playgroud)
为什么?
我有一个我创建的 powershell 脚本,如果模块尚未导入,它会尝试导入模块。
Try {
Import-Module -Name 'ModuleName' -ErrorAction Stop -ErrorVariable ModFail
}
Catch {
Write-Error "Module failed to be loaded."
}
Run Code Online (Sandbox Code Playgroud)
稍后在脚本中,我试图检查模块是否无法导入,但检查错误变量。对于未通过 errorvariable 参数设置的其他变量,我仅使用以下内容来检查其是否为空。
If ($null -eq $var) {
Do stuff
}
Run Code Online (Sandbox Code Playgroud)
但是使用我使用 errorvariable 设置的变量这样做是行不通的。
if ($null -ne $Modfail) {
Do stuff
}
Run Code Online (Sandbox Code Playgroud)
在测试变量是否实际上为空时,上述评估为真。这与我想要的相反。当我运行变量时,它确实为空并且正在运行
$modfail | Gm
Run Code Online (Sandbox Code Playgroud)
失败,因为它是空的。为什么会这样?如果我在 errorvariable 参数之外设置变量或者不设置它,它会返回正确的。即使它有空格,它也应该在管道到 Get-Member 时以正确的字符串返回?