我使用crashlytics发送报告,但崩溃不会像这样混淆:
Fatal Exception: c.a
Run Code Online (Sandbox Code Playgroud)
我在这里阅读并添加了
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
Run Code Online (Sandbox Code Playgroud)
到我的proguard-rules文件中,没有
-printmapping mapping.txt
Run Code Online (Sandbox Code Playgroud)
在我的配置文件中。这是我的build.gradle buildTypes部分:
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug_server {
minifyEnabled false
debuggable true
matchingFallbacks = ['release']
}
debug {
applicationIdSuffix '.debug'
versionNameSuffix '-DEBUG'
minifyEnabled false
}
}
Run Code Online (Sandbox Code Playgroud)
并非我所有的崩溃都是这样,并且我将crashlytics更新为2.9.4版本。
更新:
我只是跳过了
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
Run Code Online (Sandbox Code Playgroud)
因为我不需要在Crashlytics上跳过运行proguard。
UPDATE2: crashlytics的v2.9.9。直到现在还没有固定。我无法检测到错误的真正原因。
如上所述:如何在Android中启动我的APP的辅助功能设置页面? 我可以使用以下代码直接打开我的应用程序辅助功能设置:
Intent intent = new Intent();
intent.setClassName("com.android.settings",
"com.android.settings.Settings");
intent.setAction(Intent.ACTION_MAIN);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT,
"the fragment which you want show");
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS,
extras);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
但我测试了很多东西,比如app name,package name,service class name等,而不是"你想要显示的片段",但是没有用.
看看这个功能:
int c(int n,int k) {
if (n<0 || k<0 || n<k) {
return 0;
}
int c=1,p=n-k,i=1;
while (n>p) {
c = c * n/i++; // <<<
n--;
}
return c;
}
Run Code Online (Sandbox Code Playgroud)
当我改变c=c*n/i++到c*=n/i++功能无法正常工作.例如c(4,2)= 4(= 6真)我跟踪:1.i ++ 2./3.*=和所有其他可能性但没有答案.为什么?
编辑:这不是我所知道的问题.我问为什么编译器回答的c(4,2)=4时候c*=n/i++.我跟踪*/++, *++/, /*++, /++*, ++*/, ++/*但回答不是4.什么是编译器的逻辑?(抱歉英语不好)
我的项目昨天运作良好; 但是当我今天将Android studio更新到3.0时,默认情况下启用了AAPT2.我有以下错误:
Error:layout bounds on right border must start at edge.
Error:Execution failed for task ':app:mergeDevDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Run Code Online (Sandbox Code Playgroud)
我打开了日志文件,但无法找到线索.当我谷歌Error:layout bounds on right border must start at edge搜索结果中有9个补丁的问题时.我的项目中也有大约10个9补丁.但我不确定是什么问题.我知道我可以禁用Aapt2,但我想解决问题.谢谢.
我真的很纳闷.我有一个上下文:
Context context= getActivity();
Run Code Online (Sandbox Code Playgroud)
当我context在片段中使用UI时,像webview app这样的东西给了我NullPointerException(Forceclose),但是当我使用getActivity()它时效果很好.有什么区别!?让我解释一下用法.我有一个名为"A"和"B"的活动.活动"B"从活动"B"继承NavigationDrawer和Actionbar.所以有:
public class B extends A
Run Code Online (Sandbox Code Playgroud)
我们在NavigationDrawer中知道有一个主要内容.活动"B"使用片段来提供主要内容,我在该片段中使用Context.我真的很想知道!抱歉英语不好.
编辑:这是我的代码:
public class PlaceholderFragment extends Fragment {
public Context context = getActivity();
private static final String ARG_SECTION_NUMBER = "section_number";
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_text, container, false);
String text = "<html><head><link href=\"file:///android_asset/style_css.css\" rel=\"stylesheet\" type=\"text/css\"></head> <body class=\"body\"> title1 <hr> <div align=\"center\"> <img src= "+imagePath1_1+" width= \"95% \" /></div>les1</body></html>";
WebView webView= new WebView(context);
webView.loadDataWithBaseURL(null,text, …Run Code Online (Sandbox Code Playgroud) 嗨,我的问题是我的活动侦听viewmodel字段更改但未调用回调!
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityMainBinding binding = DataBindingUtil.setContentView(this,R.layout.activity_main);
binding.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable observable, int i) {
Log.d(getClass().getSimpleName(), "changed");
}
});
User user = new User("user");
binding.setUser(user);
user.setName("newUser");
}
}
Run Code Online (Sandbox Code Playgroud)
和我的视图模型:
public class User extends BaseObservable {
public String name;
public User(String name) {
this.name = name;
}
@Bindable
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
notifyPropertyChanged(BR.name);
} …Run Code Online (Sandbox Code Playgroud)