我遇到构建错误,指出我的所有 SPM 包均丢失。我决定删除每个包并将其重新添加到项目中,但每次尝试添加包都会出现以下错误:
Package.resolved 文件已损坏或格式错误;修复或删除文件以继续
我尝试删除该Package.resolved
文件并让它重新生成(但没有),但我收到了相同的错误消息。有想法该怎么解决这个吗?
更新2014年10月21日: 通过使用buildtools 21确认该问题已得到修复.
UPDATE 2014年9月18日:
在本期的状态已经更新到FutureRelease
.
更新: 我听说这可能不适用于Dagger,而且由于Espresso使用Dagger,它可能会导致一些问题.向 Gradle团队提交了一个错误.
Google最近将其Gradle实施更新为0.10.0.他们现在提供的一件事是Jacoco支持.为此,他们提到了以下设置:
testCoverageEnabled = true
Run Code Online (Sandbox Code Playgroud)
进入你的构建类型.现在,当我运行Espresso测试(使用connectedCheck
)时,当我开始执行以下:connectedAndroidTest
任务时,我收到错误:
Tests on HTC One - 4.2.2 - API 17 - 1080x1920 - 4.2.2 failed: Instrumentation run failed due to 'java.lang.VerifyError'
01:38:31 E/Device: Error during Sync: Remote object doesn't exist!
null
java.io.IOException: com.android.ddmlib.SyncException: Remote object doesn't exist!
at com.android.builder.testing.ConnectedDevice.pullFile(ConnectedDevice.java:114)
at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:158)
at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:42)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at …
Run Code Online (Sandbox Code Playgroud) 在我的AppDelegate中,我打电话
[Fabric with:@[CrashlyticsKit]];
Run Code Online (Sandbox Code Playgroud)
一切正常.现在我将我的代码拉到另一台机器上,同一行给出了以下错误:
*** Terminating app due to uncaught exception 'FabricException', reason: '[Fabric] Value of Info.plist key "Fabric" must be a NSDictionary.'
Run Code Online (Sandbox Code Playgroud)
我不知道我项目的plist中有任何新增内容.任何想法这个错误可能指的是什么以及如何解决它?
我的导航控制器间歇性地在推动时冻结.它似乎将新的视图控制器添加到堆栈中,但动画永远不会发生.我还有两个其他容器在屏幕上保存视图控制器,我可以在导航控制器冻结后很好地与它们进行交互.真正有趣的是,如果我尝试将另一个视图控制器推到导航控制器的堆栈上,我注意到堆栈顶部有一个额外的视图控制器(我最初推动的视图控制器冻结了导航控制器).所以,如果我在主屏幕上(我们将其称为VC-Home)并尝试推送新视图(VC-1)并冻结,那么我尝试推送新视图(VC-2),这是我在推送之前在当前堆栈中看到的内容:
{ [VC-Home, VC-1] }
并且在调用pushViewController之后,它保持不变; VC-2未添加到堆栈中.
据我所知,导航控制器通过在动画开始之前使前一个视图控制器处于非活动状态来启动动画,但随后动画永远不会发生,导航控制器处于冻结状态.
我正在通过调用从故事板创建新的视图控制器,
UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("ViewController")
所以我认为那里没有任何问题.我也没有在导航栏上覆盖pushViewController.关于我的应用程序的一些独特的东西是,它是非常高解析度图像重(使用SDWebImage来管理),我总是在屏幕上有三个容器在一次(一个导航控制器,用于搜索一个视图控制器,以及一个互动排水沟/侧面/滑出菜单).
CPU使用率低且内存使用率正常(发生冻结时设备稳定在60-70MB左右).
是否有任何想法可能导致这个或任何调试技巧可以帮助我发现真正的问题?
更新
UINavigationController没有唯一的代码,因为我只是推动使用pushViewController().这是调用它的代码:
func didSelectItem(profile: SimpleProfile) {
let vc = UIStoryboard.profileViewController()
vc.profile = profile
navigationController?.pushViewController(vc, animated: true)
}
Run Code Online (Sandbox Code Playgroud)
我推送的ViewController在viewDidLoad中有以下代码:
override func viewDidLoad() {
super.viewDidLoad()
button.roundView()
if let type = profile?.profileType {
//load multiple view controllers into a view pager based on type
let viewControllers = ProfileTypeTabAdapter.produceViewControllersBasedOnType(type)
loadViewPagerViews(viewControllers)
let topInset = headerView.bounds.height + tabScrollView.contentSize.height
if let viewPager = viewPager {
for view in viewPager.views {
if …
Run Code Online (Sandbox Code Playgroud) 我有一个包含三种不同构建类型的项目:debug,beta和release.我的测试包总是为调试版本创建,但QA使用beta版本,我们希望QA在其大量设备上运行这些测试.
我正在尝试为QA创建一个测试apk,它由与beta版本相同的密钥签名.通过Android-Gradle文档,我没有看到任何告诉我我不能这样做的东西,但我不认为无论如何配置它.无论如何我可以配置组装测试apk时使用哪个密钥库?或者有没有办法创建一个未签名的测试apk?
我一直在用Robolectric进行测试,这一切都很棒.然后我将Google Analytics实施到我的应用程序类,测试开始失败.当我在测试期间膨胀视图时,似乎发生了失败.这是堆栈跟踪:
java.lang.NullPointerException: null
at com.google.analytics.tracking.android.AnalyticsGmsCoreClient$AnalyticsServiceConnection.onServiceConnected(AnalyticsGmsCoreClient.java:176)
at org.robolectric.shadows.ShadowApplication$2.run(ShadowApplication.java:209)
at org.robolectric.util.Scheduler$PostedRunnable.run(Scheduler.java:162)
at org.robolectric.util.Scheduler.runOneTask(Scheduler.java:107)
at org.robolectric.util.Scheduler.advanceTo(Scheduler.java:92)
at org.robolectric.util.Scheduler.advanceToLastPostedRunnable(Scheduler.java:68)
at org.robolectric.util.Scheduler.unPause(Scheduler.java:25)
at org.robolectric.shadows.ShadowLooper.unPause(ShadowLooper.java:219)
at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:258)
at org.robolectric.shadows.ShadowViewGroup.addView(ShadowViewGroup.java:32)
at android.view.ViewGroup.addView(ViewGroup.java)
at android.view.ViewGroup.addView(ViewGroup.java:3225)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:750)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at org.robolectric.shadows.ShadowView.inflate(ShadowView.java:82)
at android.view.View.inflate(View.java)
Run Code Online (Sandbox Code Playgroud)
这是我的BaseActivity的Robolectric代码:
@RunWith(RobolectricTestRunner.class)
public class BaseActivityTest {
ActivityController<TestActivity> activityController;
TestActivity activity;
@Before
public void setUp(){
activityController = Robolectric.buildActivity(TestActivity.class).create().start();
}
@After
public void takeDown(){
activityController.stop().destroy();
activity = null;
}
@Test
public void testOnPauseState(){
activity = activityController.resume().pause().get();
assertFalse(activity.getBus().isActive());
}
}
Run Code Online (Sandbox Code Playgroud)
连接到蓝牙设备后,我正在尝试通过调用以下方法为特征写入值:
[peripheral writeValue:data forCharacteristic:characteristic type:CBCharacteristicWriteWithResponse];
Run Code Online (Sandbox Code Playgroud)
正在调用正确的回调(外围设备:didWriteValueForCharacteristic:error :)但是当我从特征中查看数据时,似乎旧数据持久存在于characteristic.value中.但是,当我断开连接并重新连接到设备时,会显示新数据.这仅发生在iOS 7上.
当我将呼叫发送到外围设备时,有什么东西可能会丢失吗?
我的UICollectionView的页脚没有显示任何子视图.我四处寻找答案,但似乎没有什么工作在我的情况下.我不确定它是否是Swift中的东西,或者我只是遗漏了一些东西.
在我的故事板中,我检查了该Section Footer
框并在页脚视图中添加了几个按钮.我已将可重用标识符设置为footer
并在视图控制器中将其注册为a.然后我打电话给collectionView(collectionView: UICollectionView!, viewForSupplementaryElementOfKind kind: String!, atIndexPath indexPath: NSIndexPath!)
它设置了它.但是,当我运行应用程序时,页脚不会显示任何子视图(footer.subviews.count
= 0).页脚的框架是正确的,但为什么我放在故事板中的子视图没有显示?
这是代码:
override func viewDidLoad() {
...
uiCollectionView.registerClass(MyFooterView.classForCoder(), forSupplementaryViewOfKind: UICollectionElementKindSectionFooter, withReuseIdentifier: "footer")
}
func collectionView(collectionView: UICollectionView!, viewForSupplementaryElementOfKind kind: String!, atIndexPath indexPath: NSIndexPath!) -> UICollectionReusableView! {
let reusableView:MyFooterView = collectionView.dequeueReusableSupplementaryViewOfKind(UICollectionElementKindSectionFooter, withReuseIdentifier: "footer", forIndexPath: indexPath) as MyFooterView
println("Footer subivews: \(reusableView.subviews.count)") // 0
return reusableView
}
Run Code Online (Sandbox Code Playgroud) 我是Jenkins和Build Servers的新手.我正在努力在Jenkins上设置Android项目,该应用程序使用Crashlytics.使用Gradle,我将我的任务设置为"clean build",但无论何时我遇到Crashlytics任务,我都会收到此错误:
java.lang.Error: Classloader conflict in your Gradle environment,
please verify you are running the latest Android plugin.
Run Code Online (Sandbox Code Playgroud)
和
Crashlytics data directory at /Users/Shared/Jenkins/Library/Caches/com.crashlytics
could not be created.
Run Code Online (Sandbox Code Playgroud)
我尝试使用"-x crashlyticsGenerateResourecesAlpha"(失败的任务)设置我的Gradle任务以跳过任务,但这似乎也不起作用.
我已经检查过我已经安装了最新的Android工具,模拟器等.我目前下载的Android插件是Android Emulator Plugin和Gradle插件(两者都是最新版本).我正在使用Git来引入我的项目.在构建项目之前,我正在启动模拟器.我指向Jenkins目录中的android-sdk文件夹.我也配置了JDK 1.7,它指向我本地盒子上的JDK目录(我在本地运行Jenkins).
以下是我运行gradle -v时收到的构建版本:
------------------------------------------------------------
Gradle 1.11
------------------------------------------------------------
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy: 2.2.0
JVM: 1.7.0_55 (Oracle Corporation 24.55-b03)
OS: Mac OS X 10.9.2 x86_64
Run Code Online (Sandbox Code Playgroud)
还有其他可能导致此错误的内容吗?我可能没有注意到Crashlytics的插件吗?另外,如果有任何我可能不知道的Jenkins调试技巧,请告诉我,我会用我发现的内容更新问题.
我正在尝试使用Google的发布/订阅为Gmail订阅邮件通知,并且已经阅读了Google提供的文档和教程。有一次,文档指出我需要发布对PubSub主题的正确权限:
您需要向授予
publish
特权serviceAccount:gmail-api-push@system.gserviceaccount.com
。您可以按照资源级访问控制说明使用Cloud Pub / Sub Developer Console权限界面执行此操作。
我的理解是,该publish
特权等同于pubsub.topics.publish
“ PubSub Publisher”或只是“ PubSub Publisher”。但是serviceAccount:gmail-api-push@system.gserviceaccount.com
呢?我在任何地方都找不到该服务帐户,并且由于字符限制,控制台不允许我创建该服务帐户。还有另一种获取此帐户的方法吗?
android ×4
ios ×4
crashlytics ×2
swift ×2
bluetooth ×1
build.gradle ×1
gmail-api ×1
gradle ×1
jacoco ×1
jenkins ×1
objective-c ×1
robolectric ×1
sdwebimage ×1
testing ×1
xcode ×1