我在项目中遇到此错误 这是我的gradle版本
var delegate: ViewControllerCResult?
func set(data: String) {
print(data)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func popControllerPressed(_ sender: Any) {
for controller in self.navigationController!.viewControllers as Array {
if controller.isKind(of: ViewController.self) {
delegate?.set(data: "data from C")
self.navigationController!.popToViewController(controller, animated: true)
break
}
}
}
}
答案 0 :(得分:1)
确保已将Maven导入您的gradle中,检查文档https://developers.google.com/android/guides/setup
答案 1 :(得分:1)
请尝试使用相同的版本控制可能会因为版本不等而出错,就像下面这样,
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-messaging:16.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-database:16.0.0'
implementation 'com.google.firebase:firebase-core:16.0.0'
答案 2 :(得分:1)
尝试使用相同版本的Api或使用外部.jar文件
答案 3 :(得分:0)
确保编译和目标sdk编号与应用程序的兼容编号相同。 像这样
compileSdkVersion 26
targetSdkVersion 26
implementation 'com.android.support:appcompat-v7:26.1.0'
答案 4 :(得分:-1)
实现fileTree(dir:'libs',包括:['* .jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-auth:11.6.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'