我有一个庞大的项目,包括数据绑定,kotlin,匕首.我花了几天时间尝试使用几个stackoverflow的解决方案来构建它,并决定亲自询问它.
我假设一些第三方库使用数据绑定,因为添加此行没有帮助.
kapt 'com.android.databinding:compiler:3.0.0'
Run Code Online (Sandbox Code Playgroud)
Android Studio说:
'androidProcessor'依赖关系不会被识别为kapt注释处理器.请将配置名称更改为'kapt'以获取这些工件:'com.android.databinding:compiler:3.0.0'.
我尝试了什么,它没有帮助:
kapt {
generateStubs = true
}
Run Code Online (Sandbox Code Playgroud)
在local.properties中: kotlin.incremental=false
另一个SO解决方案没有帮助:
kapt ('com.android.databinding:compiler:3.0.0'){
force = true
}
Run Code Online (Sandbox Code Playgroud)
我的build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'blockcanaryex'
apply plugin: 'kotlin-kapt'
apply plugin: 'newrelic'
apply plugin: 'kotlin-android-extensions'
def props = new Properties()
file("newrelic.properties").withInputStream { props.load(it) }
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
applicationVariants.all { variant ->
variant.outputs.each { output ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine "git", "symbolic-ref", "--short", "HEAD"
standardOutput …Run Code Online (Sandbox Code Playgroud) 我试图为我的应用程序制作社交模块,类似于包装器,它将包含Google +,Facebook和Twitter集成模板.
现在我正在使用Facebook SDK并决定在我的应用程序中使用LeakCanary,在成功登录后我将设备旋转几次,并查看以下信息:
这是MainActivity.class:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
setFragment();
}
private void setFragment(){
getSupportFragmentManager()
.beginTransaction()
.add(R.id.container, new MainFragment())
.commit();
}
}
Run Code Online (Sandbox Code Playgroud)
以下是我登录Facebook的方式:
public void configureFacebook(@NonNull Fragment fragment,
@Nullable String permissions, @Nullable String requestFields) {
setPermissionAndRequestFields(permissions, requestFields);
loginManager = LoginManager.getInstance();
callbackManager = CallbackManager.Factory.create();
loginManager.registerCallback(callbackManager, facebookCallback);
loginManager.logInWithReadPermissions(fragment, Arrays.asList(this.permissions));
loginManager=null;
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用登录按钮登录,在这种情况下,我抓住了这个问题和新的问题,并提供以下信息:
以下是我使用LoginButton.class登录的方法:
public void configureFacebook(@NonNull Fragment fragment,
@Nullable String permissions, @Nullable String requestFields, @NonNull LoginButton button) {
callbackManager = CallbackManager.Factory.create(); …Run Code Online (Sandbox Code Playgroud) 我写了一个时间跟踪应用程序,在logcat中经常可以看到:
2028-2070/? D/MobileDataStateTracker? default: setPolicyDataEnable(enabled=true)
05-04 04:02:25.140 2028-2070/? D/MobileDataStateTracker? default: setPolicyDataEnable(enabled=true)
05-04 04:02:40.192 2028-2070/? D/MobileDataStateTracker? default: setPolicyDataEnable(enabled=true)
05-04 04:02:53.216 2028-2070/? D/MobileDataStateTracker? default: setPolicyDataEnable(enabled=true)
05-04 04:02:54.128 3575-3575/? D/dalvikvm? GC_FOR_ALLOC freed 1094K, 19% free 6781K/8288K, paused 4ms, total 4ms
05-04 04:02:55.468 3575-3575/? I/Choreographer? Skipped 80 frames! The application may be doing too much work on its main thread.
05-04 04:02:56.524 2028-2070/? D/MobileDataStateTracker? default: setPolicyDataEnable(enabled=true)
05-04 04:03:08.504 2028-2070/? D/MobileDataStateTracker? default: setPolicyDataEnable(enabled=true)
05-04 04:03:19.584 2028-2070/? D/MobileDataStateTracker? default: setPolicyDataEnable(enabled=true)
05-04 04:03:23.792 65-65/? D/Genyd? Received Set …Run Code Online (Sandbox Code Playgroud) 我知道SOF有很多类似的问题,但我没有找到对我有用的东西.根据Google Custom Search文档,&start参数:
The start parameter uses a zero-based index, meaning the first result is 0, the second result is 1 and so forth.
The start parameter works in conjunction with the num parameter to determine which search results to return.
Run Code Online (Sandbox Code Playgroud)
我尝试从零发送,但应用程序崩溃.在这次尝试中我尝试发送:
为1页: &num=10&start=1
2页: &num=10&start=11
但它仍然要求1页.&start参数始终被忽略
我正在写一个Android应用程序,它进行图像搜索,在向下滚动它应该在下一页(下10个图像),在android 它总是返回1页有10个图像,我在浏览器中测试请求,withount &num参数,它的工作原理.在Android上,似乎在第一页加载后,参数&start和&num被忽略.
我使用robospice与改造相结合,我无法弄清楚如何获取请求字符串,也许我做错了什么
这是我的界面:
public static final String BASE_URL = "https://www.googleapis.com/customsearch";
public static final String API_KEY = "AIzaSyCCuxxVLzm2sZP-adhRNYKeSck1mMMgsAM";
public static …Run Code Online (Sandbox Code Playgroud) 我的目标是使用Google Places API进行自动完成预测,现在我想制作一些将采用当前位置lat和lng的算法,并预测直径仅为100-200 km的地方.
那么,此时我得到用户当前位置lat和lng,如何设置100-200 km?
private void getCurrentLocation() {
mLastLocation = LocationServices.FusedLocationApi
.getLastLocation(mGoogleApiClient);
if (mLastLocation != null) {
double latitude = mLastLocation.getLatitude();
double longitude = mLastLocation.getLongitude();
mLatLonBounds = new LatLngBounds(new LatLng(latitude,longitude),
new LatLng(latitude,longitude));
Log.d("myTag","lat = "+mLatLonBounds.northeast.latitude+" ,lon = "+mLatLonBounds.northeast.longitude);
//Log.d("myTag","lat = "+mLatLonBounds.southwest.latitude+" ,lon = "+mLatLonBounds.southwest.longitude);
}else {
//some code
}
}
Run Code Online (Sandbox Code Playgroud)
以下是我如何设置自动预测的界限:
@Nullable
private ArrayList<AutoCompletePlace> getAutocomplete(CharSequence constraint) {
if (mGoogleApiClient.isConnected()) {
Log.i(Constants.AUTO_COMPLETE_TAG, "Starting autocomplete query for: " + constraint);
// Submit the query to the autocomplete API and retrieve …Run Code Online (Sandbox Code Playgroud) 我想返回带有泛型的类型,通过子图公开,问题出在自动生成的java类中,我试着做一些事情,但解决它的一种方法是从AppComponent中删除泛型类型并返回简单对象.有更"正确"的方法吗?
这是AppComponent
@Singleton
@Component(modules = arrayOf(ApplicationModule::class))
interface ApplicationComponent {
fun inject(activity: BaseActivity<MvpView, MvpPresenter<MvpView>>)
//...
fun dataBase(): Database<Realm>
}
Run Code Online (Sandbox Code Playgroud)
这是ApplicationModule中的函数
@Provides @Singleton fun provideDatabase(@AppContext context: App): Database<Realm> {
Realm.init(context)
val config = RealmConfiguration.Builder()
.deleteRealmIfMigrationNeeded()
.name("db")
.build()
Realm.setDefaultConfiguration(config)
return RealmDatabase(Realm.getDefaultInstance())
}
Run Code Online (Sandbox Code Playgroud)
然后我想收到我的数据库
@Provides @ActivityScope fun provideDich(database: Database<Realm>) = Someobject(database)
Run Code Online (Sandbox Code Playgroud)
然后我看到日志说:
**Error:com.test.data.storage.Database<? extends io.realm.Realm> cannot be provided without an @Provides-annotated method.**
Run Code Online (Sandbox Code Playgroud)
因为dagger2生成这样的工厂并且有java掩码
public final class Logout_Factory implements Factory<Logout> {
private final MembersInjector<Logout> logoutMembersInjector;
private final Provider<SessionStorage.CloudStorage> arg0Provider;
private final Provider<Database<? extends Realm>> arg1Provider; …Run Code Online (Sandbox Code Playgroud) 我已经阅读了所有类似的问题并完成了其中描述的所有内容,但没有帮助.
Google Maps API v2已启用且API密钥正确无误
我刚刚在"新项目"中选择了GoogleMapsActivity,然后创建了一个key.jks,通过keytool创建了sha1,创建了公共api访问密钥,将我的API密钥放入了清单.
我试过:clean-rebuild-unistall app-install
多次更新api密钥
用new key.jks创建一个新项目(并且一遍又一遍)
删除并创建api密钥
这是我的清单:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dandewine.user.thinkmobiletest" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--
Run Code Online (Sandbox Code Playgroud)
使用Google Maps Android API v2不需要ACCESS_COARSE/FINE_LOCATION权限,但建议使用这些权限. - >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIza**************************" />
<activity
android:name=".ActivityMain"
android:label="@string/title_activity_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Run Code Online (Sandbox Code Playgroud)
这是我的活动:
public class ActivityMain extends FragmentActivity implements OnMapReadyCallback {
@Override
protected void onCreate(Bundle savedInstanceState) { …Run Code Online (Sandbox Code Playgroud) 我试图在heroku上部署服务器,但我停留在应该使用Godep的步骤上,我花了很少的时间在GO上,最近两天我一直在寻找如何解决此问题的方法,实际上这是一个很受欢迎的问题,但是我无法确定出来,也许我做错了什么。
我有OS X 10.11.2
我的GOPATH-用户/ denis / Programming / Golang
我的路径-$ GOPATH / bin
我试图对放在$ GOPATH / src / backend中的项目使用godep
在我的PATH中,我有一个可执行的Godep文件(不是.go)。
我工作场所的整体结构。
/Golang/
.bin/
godep //executable file
.pkg/
.darwin-amd64/
.//other folders/
.src/
.github.com/
.backend/
.//other folders//
Run Code Online (Sandbox Code Playgroud) 我不使用Proguard.该项目正在成功构建,但当我尝试在设备上运行时,它显示此错误.我在Android Studio 3.0中使用Kotlin项目工作,这真的很糟糕.我决定切换回2.3 AS,但问题仍然是一样的.日志较小但异常文本相同.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
tasks.withType(JavaCompile) {
options.fork = true
options.incremental = true
}
android {
def rootProject = rootProject.ext
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode rootProject.versionCode
versionName rootProject.versionName
testInstrumentationRunner rootProject.testInstrumentationRunner
vectorDrawables.useSupportLibrary = true
// multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
//flavorDimensions "content"
production { …Run Code Online (Sandbox Code Playgroud) 这是我所拥有的:
是否可以以某种方式降低按钮覆盖层,但不更改布局。我正在使用相对。问题是当按钮转到数字的行位置时,按钮的一小部分不可见。
这里的 .xml 片段:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="65dp"
android:orientation="vertical"
android:padding="8dp"
android:background="@drawable/shadow_listitem">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" android:text="Task is Finish!"
android:id="@+id/txtFinish"
android:visibility="gone"
android:layout_alignBottom="@+id/tvDays"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" android:text="Name" android:id="@+id/tvName"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_marginLeft="-27dp"
android:text="0000" android:id="@+id/tvDays"
android:layout_alignTop="@+id/textView4"
android:layout_toLeftOf="@+id/textView4"
android:layout_toStartOf="@+id/textView4"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" android:text="00" android:id="@+id/tvHours"
android:layout_toLeftOf="@+id/textView2"
android:layout_toStartOf="@+id/textView2"
android:layout_below="@+id/tvName"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" android:text="00" android:id="@+id/tvMinutes"
android:layout_alignTop="@+id/textView8"
android:layout_toLeftOf="@+id/textView8"
android:layout_toStartOf="@+id/textView8"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" android:text=":" android:id="@+id/textView8"
android:layout_alignTop="@+id/tvSeconds"
android:layout_toLeftOf="@+id/tvSeconds"
android:layout_toStartOf="@+id/tvSeconds"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" android:text="00" android:id="@+id/tvSeconds"
android:layout_below="@+id/tvName" …Run Code Online (Sandbox Code Playgroud) android ×10
java ×3
kotlin ×3
bottombar ×1
dagger-2 ×1
data-binding ×1
generics ×1
geolocation ×1
go ×1
google-maps ×1
gradle ×1
heroku ×1
listview ×1
memory-leaks ×1
rest ×1
xml ×1