我有一堆第三方库,我包含在我的基础应用程序中.我无法控制那些第三方模块包含的支持库.这使我很难在我的应用程序中拥有相同版本的android支持库.
当我可以从每个依赖项中排除某些库时,我知道使用gradle:
compile('com.test:lib1:1.0.0') {
exclude group: 'com.android.support'
}
Run Code Online (Sandbox Code Playgroud)
然而,有大量的支持库,并将它们全部排除在我的第三方库的每一个看起来像是矫枉过正.
有没有更好的办法?
阅读这篇博文:https://www.devsbedevin.com/android-understanding-gradle-dependencies-and-resolving-conflicts/
它表明:
configurations.all {
resolutionStrategy {
preferProjectModules()
}
}
Run Code Online (Sandbox Code Playgroud)
但是当使用它时,我仍然在我的gradle文件中的Android Studio中收到警告,检测到有多个版本的支持库.
如果我的依赖项依赖于支持库的不同版本,我该怎么办?在上面的任何一种情况下,我都会强迫第三方库使用它们未构建的特定版本的支持库.我应该使用哪个版本?最新的支持库?Min支持所有第三方依赖的库?
这是一个最小的gradle文件示例,显示了第三方依赖项,每个依赖项依赖于它们自己的支持库版本.
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.example.app"
minSdkVersion 17
targetSdkVersion 25
}
}
configurations.all {
resolutionStrategy {
preferProjectModules()
}
}
dependencies {
compile 'com.android.support:support-v13:26.0.0'
compile 'com.test:lib1:1.0' // depends on support-v13:25.0.0
compile 'com.test:lib2:1.0' // depends on support-v13:25.2.0
compile 'com.test:lib3:1.0' // depends on support-v13:25.4.0
compile 'com.test:lib4:1.0' // depends on support-v13:26.0.0
}
Run Code Online (Sandbox Code Playgroud)
Android studio提供以下警告:
android dependency-management gradle android-studio android-gradle-plugin
在执行时,npx react-native init MyProject我遇到了以下错误:
? Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Run Code Online (Sandbox Code Playgroud)
这似乎与之前显示的错误有关:
checking for arm-apple-darwin-gcc... /Library/Developer/CommandLineTools/usr/bin/cc -arch armv7 -isysroot
checking whether the C compiler works... no
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'
Run Code Online (Sandbox Code Playgroud)
XCode 及其 …
我正在尝试发布我的NPM包:npm publish.
我得到以下相当神秘的错误:
npm ERR! path c:\Temp\npm-20936-b98f84c8\tmp\fromDir-02dd5394\package.tgz
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'c:\Temp\npm-20936-b98f84c8\tmp\fromDir-02dd5394\package.tgz'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, unlink 'c:\Temp\npm-20936-b98f84c8\tmp\fromDir-02dd5394\package.tgz'
npm ERR! at Error (native)
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink 'c:\Temp\npm-20936-b98f84c8\tmp\fromDir-02dd5394\package.tgz'
npm ERR! at Error (native)
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink', …Run Code Online (Sandbox Code Playgroud) 我正在使用UIDocumentInteractionController方法将我的应用程序中的图像共享到WhatsApp(在如何从我的应用程序发送图像到WhatsApp中进行了解释?,WhatsApp图像共享iOS).
我也知道通过URI选项的共享,用于仅共享文本(在此解释:https://www.whatsapp.com/faq/iphone/23559013).
有没有办法在一个共享中共享图像和标题?
我刚刚浏览了他们的主页,它说,
适用于Android和Java的类型安全的HTTP客户端
为什么Retrofit将自己宣传为Type Safe,而其他图书馆(许多其他受欢迎的图书馆)则没有?
在你回答之前......
有一个答案,同样的问题在这里.它说,
类型安全性是编程语言阻止或防止类型错误的程度.类型错误是由程序的常量,变量和方法(函数)的不同数据类型之间的差异引起的错误或不期望的程序行为,例如,将整数(int)视为浮点数(浮点数).这在静态类型语言(如Java和C)中很常见
因此,Retrofit可以防止此类错误
如果这确实是答案,那么许多库会阻止这些类型的错误,但它们都不会作为类型安全广告.那是营销吗?
我认为上述答案不充分,因为类型安全的定义尚未得到认真对待.
无论如何,还有另一篇文章定义了类型安全.他们给出了例子:
类型安全意味着编译器将在编译时验证类型,如果尝试将错误的类型分配给变量,则抛出错误.
一些简单的例子:
Run Code Online (Sandbox Code Playgroud)// Fails, Trying to put an integer in a string String one = 1; // Also fails. int foo = "bar";这也适用于方法参数,因为您将显式类型传递给它们:
Run Code Online (Sandbox Code Playgroud)int AddTwoNumbers(int a, int b) { return a + b; }如果我尝试使用以下方法调用:
Run Code Online (Sandbox Code Playgroud)int Sum = AddTwoNumbers(5, "5");
根据上面的定义,它将是语言(Java),而不是特定于TypeSafe的库.
所以,我再次问,为什么Retrofit将自己宣传为类型安全库?
我偶然发现了一个奇怪的行为,其中添加到a的单元格UITableView有时会向左缩进.这只发生在iOS 8.3上,我找不到关于何时发生这种情况的明确模式.
有没有人遇到过同样的事情?
我有一个使用React-Native构建的Android项目,并使用Google Play服务(分析,云消息,广告).我没有在任何地方明确使用Firebase.
尝试从8.4.0 => 9.2.0升级Play服务.还升级了GPS类路径.
buildscript {
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
Run Code Online (Sandbox Code Playgroud)
...
dependencies {
compile 'com.google.android.gms:play-services-analytics:9.2.1'
compile 'com.google.android.gms:play-services-ads:9.2.1'
compile 'com.google.android.gms:play-services-base:9.2.1'
compile 'com.google.android.gms:play-services-gcm:9.2.1'
Run Code Online (Sandbox Code Playgroud)
请注意,我并未明确依赖Firebase.
自升级以来,我收到以下Gradle构建错误:
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/firebase/FirebaseApiNotAvailableException.class
我知道Firebase捆绑在Google Play服务中(从9.0开始),所以我想其他的东西正在编译并链接到旧版本.所以看看依赖洞察力(gradle -q dependencyInsight --configuration compile --dependency firebase)我注意到firebase-common 9.0.0正在9.2.1之上添加:
但我不能为我的生活找出导致这种情况的原因.
android firebase google-play-services android-gradle-plugin react-native
我的应用程序上有一个非常完整的数据库.
当需要添加更多功能时,我开始想知道是否应该通过向现有数据库添加更多表来实现它,或者为增加的功能打开一个全新的数据库并在那里添加表.
关于何时开设新数据库有什么基本规则吗?该主题是否有任何基准?
我有一个使用React-Native的项目.我正在从源代码构建RN模块,因此我的项目将ReactAndroid模块作为依赖项.
我试图将项目升级到Android gradle构建工具> = 2.3.2,所以我可以使用intant-run:
buildscript {
repositories {
jcenter()
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
...
}
}
Run Code Online (Sandbox Code Playgroud)
这一变化迫使我将gradle本身从3.1升级到3.5(最新稳定).
构建项目会突然产生以下gradle错误
无法为org.gradle.api.Project类型的项目':ReactAndroid'获取未知属性'repositoryUrl'.
有人可以帮忙吗?
android gradle android-studio android-gradle-plugin react-native
在尝试调试我的视图层次结构时,出现以下错误:
Error: Unable to capture view hierarchy.
Details: No plist data for fetching view hierarchy: error evaluating expression “(id)[(Class)objc_getClass("DBGViewDebuggerSupport_iOS") fetchViewHierarchyWithOptions:(id)[(Class)objc_getClass("NSDictionary") dictionaryWithObjects:(id)[(id)[(id)[(Class)objc_getClass("NSArray") arrayWithObject:(id)[(Class)objc_getClass("NSNumber") numberWithBool:1]] arrayByAddingObject:(id)[(id)[(Class)objc_getClass("NSArray") arrayWithObject:@"_UIVisualEffectBackdropView"] arrayByAddingObject:@"_UIBackdropEffectView"]] arrayByAddingObject:(id)[(Class)objc_getClass("NSNumber") numberWithBool:0]] forKeys:(id)[(id)[(id)[(Class)objc_getClass("NSArray") arrayWithObject:@"DBGViewDebuggerUseLayersAsSnapshots"] arrayByAddingObject:@"DBGViewDebuggerEffectViewsToSnapshotAsImage"] arrayByAddingObject:@"DBGViewDebuggerAlwaysEncodeLayers"]]]”: error: Expression can't be run, because there is no JIT compiled function
Method: -[DBGAbstractViewDescriber handleFetchedViewInfo:fetchError:resultHandler:]
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
Run Code Online (Sandbox Code Playgroud)
在iPhone 6 10.2和iPhone 5C 9.3.5上发布.XCode是8.2.1.Mac机是Sierra 10.12.2(16C67).
始终可重复 - 永远不会让它发挥作用.
有人知道吗?
android ×5
ios ×4
react-native ×3
gradle ×2
java ×2
npm ×2
database ×1
firebase ×1
ios8.3 ×1
node.js ×1
npm-publish ×1
npmjs ×1
objective-c ×1
retrofit ×1
retrofit2 ×1
share ×1
sql ×1
sqlite ×1
type-safety ×1
uitableview ×1
uiview ×1
whatsapp ×1
xcode8 ×1