随着Android系统的注解,我可以代替AsyncTask<Param, Progress, Result>使用@UiThread.
但是可以处理像AsynkTask的onPreExcecute/onPostExecute这样的东西吗?
AndroidAnnotations版本: 4.3.1
Android compile SDK版本: 26
Kotlin版本: 1.1.3-2
我正在尝试使用Kotlin和AndroidAnnotaions构建应用程序。构建以
Error:Execution failed for task ':app:kaptDebugKotlin'. > Internal compiler error. See log for more details
Run Code Online (Sandbox Code Playgroud)
在androidannotations.log一个像这样的大量错误
00:10:43.908 [RMI TCP Connection(91)-127.0.0.1] ERROR o.a.i.p.ModelValidator:77 - org.androidannotations.annotations.ViewById cannot be used on a private element
Run Code Online (Sandbox Code Playgroud)
多数民众赞成在@ViewById注释的用法
@ViewById
var description: TextView? = null
Run Code Online (Sandbox Code Playgroud)
对于带有Pref注释的var,也是如此。
还有其他人面临同样的问题吗?还是我自己?
有人知道如何在Android Annotations中使用Proguard吗?
我找到了这个资源:https: //code.google.com/p/androidannotations/wiki/ProGuard
但是当我从那里使用proguard.cfg文件时,我收到以下错误:
proguard.ParseException: Unknown option '*' in line 6 of file
'/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/proguard.cfg'
Run Code Online (Sandbox Code Playgroud)
这是我从链接中复制的proguard.cfg文件:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/ *,!class/merging/ *
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>; …Run Code Online (Sandbox Code Playgroud) 我正在使用Android注释,最近发现了一个错误Spring Rest Template使用导致EOFException,我不知道如何使用注释修复.我有帖子请求:
@Post("base/setItem.php")
Item setItem(Protocol protocol);
Run Code Online (Sandbox Code Playgroud)
现在,我该如何设置标题
headers.set("Connection", "Close");
Run Code Online (Sandbox Code Playgroud)
这个要求?
谢谢!
这是我的代码
活动:
@RoboGuice
@EActivity(R.layout.result_page)
public class ResultActivity extends SherlockListActivity implements ActionBar.OnNavigationListener{
@ViewById TextView src;
@ViewById TextView dest;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(src==null || dest==null)
Toast.makeText(this, "@ViewById does not work", Toast.LENGTH_SHORT).show();
//More Code here
}
}
Run Code Online (Sandbox Code Playgroud)
布局的一部分: - 注意:有许多嵌套布局 - 仅显示布局文件的一部分
<RelativeLayout
android:id="@+id/topRight"
android:layout_toRightOf="@id/topLeft"
android:layout_height="wrap_content"
android:layout_width="0px"
android:layout_weight="0.8">
<TextView
android:id="@+id/src"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#3399FF"
android:maxLines="1"
android:paddingLeft="8dp"
android:textSize="16dp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/bottomRight"
android:layout_toRightOf="@id/bottomLeft"
android:layout_height="wrap_content"
android:layout_width="0px"
android:layout_weight="0.8">
<TextView
android:id="@+id/dest"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:maxLines="1"
android:textColor="#3399FF"
android:paddingBottom="10dp"
android:textSize="16dp"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我想在TextViews上做一个setText().我想知道我实现接口(我需要的)是否会使@ViewById成为故障.还是我错过了什么?
我正在使用android注释,并且我需要在我的activity中的onResume()函数中执行一些代码.
从android注释活动(即使用@EActivity)覆盖onResume函数是否安全?
关于Android注释,
@AfterViews等同于onCreate或onPostCreate吗?
或每个注释的等效项是什么?
我可以删除“ onCreate”和“ onPostCreate”方法,并将我的全部代码都与@AfterViews放在同一方法中吗?
我正在尝试构建一个项目,但是当我尝试从命令行构建它时出现以下错误:
error: Could not find the AndroidManifest.xml file, going up from path [C:\Users\User\Documents\work
space\app\app\app\build\generated\source\apt\debug] found using dummy file []
(max atempts: file:///C:/Users/User/Documents/workspace/app/app/app/build/generated/source/apt/debug/dummy1449680140847.java)
Run Code Online (Sandbox Code Playgroud)
我的manifest.xml位于项目结构中的主要对象之下。这是我的gradle文件:
import com.android.builder.core.DefaultManifestParser
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.ponideapps.recetapp"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// This is important, it …Run Code Online (Sandbox Code Playgroud) 我有一个与Robolectric的Android项目.
我的应用程序相关类被放入src/main/java并测试相关的类src/test/java.
我有这些测试依赖项 pom.xml
<dependency>
<groupId>org.robolectric</groupId>
<artifactId>robolectric</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
从控制台构建和部署时,mvn package android:deploy一切正常.从Eclipse(Juno)启动项目时出现问题.
[2013-03-24 12:27:26 - Dex Loader] Unable to execute dex: Multiple dex files define Lorg/apache/maven/artifact/Artifact;
[2013-03-24 12:27:26 - my-app] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/apache/maven/artifact/Artifact;
Run Code Online (Sandbox Code Playgroud)
似乎仅包括Robolectric所需的依赖性.我究竟做错了什么?
我如何使用@FragmentArg从AndroidAnnotations内Kotlin片段?
@EFragment(R.layout.debug_empty_fragment)
open class EmptyFragment : Fragment(){
@FragmentArg("debugIndex")
var debugIndex:Int = 0
}
Run Code Online (Sandbox Code Playgroud)
这给了我以下gradle错误:
error: org.androidannotations.annotations.FragmentArg cannot be used on a private element
Run Code Online (Sandbox Code Playgroud)
我试图使debugIndex open (公共),但它不起作用。有任何想法吗?这有可能吗?
我正在使用Android Annotations 4.3.1和kotlin 1.1.2-5
android ×8
annotations ×2
kotlin ×2
findviewbyid ×1
gradle ×1
http-headers ×1
proguard ×1
robolectric ×1