无法解析符号getIntent(),findViewById等

时间:2016-02-29 18:33:44

标签: java android

无法解析符号import SpriteKit class GameScene: SKScene ,SKPhysicsContactDelegate { let ballCategory:UInt32 = 0x1 << 0 let bottomCategory:UInt32 = 0x1 << 1 let paddleCategory:UInt32 = 0x1 << 2 override init(size: CGSize){ super.init(size: size) physicsWorld.contactDelegate = self let ball = SKSpriteNode(imageNamed: "ball") ball.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)) addChild(ball) ball.physicsBody = SKPhysicsBody(circleOfRadius: self.frame.size.width / 2) ball.physicsBody?.dynamic = true ball.physicsBody?.allowsRotation = false ball.physicsBody?.friction = 0 // ball.physicsBody?.applyImpulse(CGVectorMake(2,-2)) ball.physicsBody?.categoryBitMask = ballCategory ball.physicsBody?.contactTestBitMask = paddleCategory ball.physicsBody?.collisionBitMask = paddleCategory ball.physicsBody?.affectedByGravity = true let paddle = SKSpriteNode(imageNamed: "paddle") paddle.position = CGPointMake(CGRectGetMidX(self.frame), paddle.frame.size.height * 2) addChild(paddle) paddle.physicsBody = SKPhysicsBody(rectangleOfSize: paddle.frame.size) paddle.physicsBody?.affectedByGravity = false paddle.physicsBody?.dynamic = false paddle.physicsBody?.categoryBitMask = paddleCategory } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { } func didBeginContact(contact: SKPhysicsContact) { print("touched") } override func update(currentTime: CFTimeInterval) { /* Called before each frame is rendered */ } } findViewById()以及更多基本功能,也许我对资源文件做错了,但我现在不知道该怎么做才能纠正。

getApplicationContext()

3 个答案:

答案 0 :(得分:1)

应用程序没有成功构建,因为@vasilis提到尝试清理和重建项目。如果不能解决问题,请重新启动工作室,最糟糕的情况下重新启动系统。

答案 1 :(得分:1)

您似乎遇到了Android Studio中的损坏缓存错误。

修复:文件&gt;使高速缓存/重新启动无效

答案 2 :(得分:0)

虽然不是很有效但我找到了方法,但我顺便说一句。我将整个项目复制到另一个位置并从那里打开。 MAGIC它对我有用。

相关问题