草庐IT

METHOD_NAME

全部标签

android - 如何添加两个android :name attributes to Application tag in Manifest file?

我的Android应用程序需要两个应用程序类,一个是volleyAppController,另一个是Analytics类。我很困惑如何同时添加这两个类。请帮助我,让我摆脱这个。 最佳答案 您需要实现多级继承来解决这种情况。这是您的场景publicLib1ApplicationextendsApplication{}publicLib2ApplicationextendsApplication{}publicYourApplicationextendsApplication{}如何解决?publicLib1Applicationext

android - 初始化 SharedPreferences 给出 : Attempt to invoke virtual method on a null object reference

当我启动我的应用程序时,它崩溃了,并给我这个错误代码。Attempttoinvokevirtualmethod'android.content.SharedPreferencesandroid.content.Context.getSharedPreferences(java.lang.String,int)'onanullobjectreference这是我的主要Activity:packagecom.awplicity.testappshared;importandroid.content.Context;importandroid.content.Intent;importand

android - 错误 :No resource found that matches the given name (at 'resource' with value '@xml/provider_paths' )

我正在开发一个用于谷歌服务文本检测的应用程序,遇到使用File_PROVIDER共享文件的问题。AndroidManifest.xml:对于res/xml/provider_paths.xml:但是我总是得到这个编译错误:错误:找不到与给定名称匹配的资源(在值为“@xml/provider_paths”的“资源”处)。出了什么问题? 最佳答案 我只是在同一个问题上花了很长时间。有些人建议拼写错误(那里没有拼写错误)有些人提到了其他可能性,例如错误的文件夹或修改config.xml或检查sdk版本的建议技术....我缺少的是“prov

java - 安卓测试 : Can I send sms to the emulator number from test method?

我从另一个团队收到了一些代码,开始进行简单的改进和重构。第一阶段是向项目添加单元测试。我需要测试解析输入短信的功能。与上述信息相关,我的问题是:-我可以从测试方法向模拟器端口发送短信吗?我写了下一个代码,但没有收到任何东西......@TestpublicvoidsendSmsTest(){SmsManagersmsManager=SmsManager.getDefault();smsManager.sendTextMessage("5554",null,getSms("sms1"),null,null);}privateStringgetSms(StringsmsKey){retur

java - JNI/安卓 : call to non static method in Java from C++?

我得到了以下当前调用静态Java方法的JNI方法:voidbindToMarketBillingServiceJNI(constchar*inappID){JniMethodInfot;if(JniHelper::getStaticMethodInfo(t,"com/mycompany/games/js/TestsDemo","bindToMarketBillingService","(Ljava/lang/String;)V")){jstringstringArg1;if(!inappID){stringArg1=t.env->NewStringUTF("1");}else{stri

安卓工作室 Gradle : Error:Configuration with name 'compile' not found

我的项目刷新失败,并出现以下gradle脚本的错误:错误:找不到名为“compile”的配置。//顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。buildscript{repositories{mavenCentral()}dependencies{classpath'com.android.tools.build:gradle:2.3.2'classpath'com.google.gms:google-services:3.1.0'//NOTE:Donotplaceyourapplicationdependencieshere;theybelong//intheind

安卓工作室 : 'name' attribute should be defined

今天我打开了AndroidStudio,这是我发现的:我的资源文件(字符串、样式、尺寸、颜色)也是如此: 最佳答案 和元素没有名为'eventName'的属性.他们有必需的元素'name'在你的情况下,它丢失了。看起来您已经进行了搜索和替换操作并替换了'name'带有'eventName'的属性因为失误。恢复此替换,问题就会消失。 关于安卓工作室:'name'attributeshouldbedefined,我们在StackOverflow上找到一个类似的问题:

java - Android Retrofit : missing method body, 或声明抽象

我正在编写一个将使用Retrofit发出API请求的Android应用。我有一个这样的辅助类:publicclassApiService{publicstaticfinalStringTAG=ApiService.class.getSimpleName();publicstaticfinalStringBASE_URL="https://myapiurl.com";publicstaticvoidtestApi(){ApiEndpointInterfaceapiService=prepareService();apiService.ping(newCallback(){@Overrid

android - Gradle : No resource type specified (at 'text' with value '@{user.name}' ). 数据绑定(bind)不工作

我试图将适当的数据绑定(bind)功能添加到我的项目中,但由于某种原因它仍然失败。build.gradle文件如下所示:applyplugin:'com.android.application'buildscript{repositories{mavenCentral()}dependencies{classpath'me.tatarka:gradle-retrolambda:3.2.5'}}repositories{mavenCentral()}applyplugin:'com.android.application'applyplugin:'me.tatarka.retrolamb

安卓开发 : Undefined Method

大家好,我是Android和Eclipse的新手。我刚刚遵循了developer.android.com的教程。现在我在addingActionBar现在我在这部分@OverridepublicbooleanonOptionsItemSelected(MenuItemitem){//Handlepressesontheactionbaritemsswitch(item.getItemId()){caseR.id.action_search:openSearch();returntrue;caseR.id.action_settings:openSettings();returntrue