Dav*_*las 4 android manifest gradle android-manifest android-gradle-plugin
好的,因此我无法按照Android Studio的要求进行任何开发。我的所有项目到处都是错误,这些错误由Android Studio引起。
注意:我的文件是正确的,这是另一个问题,因为即使我从google代码中导入某些内容也会出错。
当我导入一个项目时,一切都很好,但是在建立索引等之后,所有突然的事情都是红色的,不应该这样。
我的错误例如是:
button1.setOnLongClickListener(new View.OnLongClickListener()
{
....
....
}
Run Code Online (Sandbox Code Playgroud)
好吧,应该不是错误,但: cannot resolve symbol setOnLongClickListener
另一个例子:
button1=(Button) findViewById(R.id.button1);
Run Code Online (Sandbox Code Playgroud)
我将这个确切的代码用于其他按钮,似乎是正确的,我一直使用此行,直到我的Android Studio决定给我一些辛苦的时间,这行很好,此行充满了错误,它们是:
Unknown class: 'button1' , invalid method declaration; return type required, missing method body, or declare abstract
Run Code Online (Sandbox Code Playgroud)
我尝试了20种不应该发生的错误:
我的模块:app build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "firstappdevelopments.david.reactiontime"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
}
Run Code Online (Sandbox Code Playgroud)
我现在也注意到,清单文件中的一个错误android:name=".MainActivity"表示它没有默认结构。这样的事情。这是完整的普通代码:
<?xml version="1.0" encoding="utf-8"?>
Run Code Online (Sandbox Code Playgroud)
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
</manifest>
Run Code Online (Sandbox Code Playgroud)
拜托,如果有人知道是什么问题或我还能做什么,请说,我对我的英语感到抱歉,谢谢大家。
我所看到的是我的代码中充满了错误,但是它仍然可以正常运行并将其很好地部署到设备上。
要解决这个问题:
| 归档时间: |
|
| 查看次数: |
1596 次 |
| 最近记录: |