单例模式的各种实现->单例模式
问题解决方法见 Issues
实用技巧见 Wiki
Issues:
External Native Build Issues: SIMPLE: Error configuring
Unsupported major.minor version 52.0
Wiki:
Android Developer(Android 知识集锦,解决遇到的坑)
Home Page: https://github.com/nesger/AndroidNote
License: Apache License 2.0
单例模式的各种实现->单例模式
问题解决方法见 Issues
实用技巧见 Wiki
Issues:
External Native Build Issues: SIMPLE: Error configuring
Unsupported major.minor version 52.0
Wiki:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
使用 Button 来替代
找到 settings.gradle
文件
在文件里面找到
rootProject.name = xxx
确保这个写的文件名和项目文件名完全一致。尤其是大小写!
如果 AndroidStudio 不能查看源码,并且 Download 之后还是一样。那么可以按照下面方式处理。
执行命令
cd ~/Library/Preferences/AndroidStudio3.4/options
进入配置目录。
其中我这里 AndroidStudio 版本为 3.4,如果你的版本为其他,上面的目录应该为 AndroidStudio 加上对应版本号。
然后编辑 jdk.table.xml。
里面有各个 SDK 版本的配置。
假设你 AndroidStudio 提示的是 27 有问题,你查找 27。
可以看到
<name value="Android API 27 Platform" />
往下可以看到下面
<sourcePath>
<root type="composite">
</root>
</sourcePath>
发现缺少源码路径配置,添加修改如下:
<sourcePath>
<root type="composite">
<root url="file://$USER_HOME$/Library/Android/sdk/sources/android-27" type="simple" />
</root>
</sourcePath>
保存之后重启 AndroidStudio 应该就可以了。
该方案是解决使用普通命令,比如 ls 显示中文文件夹没问题,但是 git log 查看 commit 信息中文乱码问题。
在 ~/.zshrc 追加下面两行
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
然后执行 source ~/.zshrc 让配置生效即可
进入拨号界面输入:
*#*#2846579#*#*
点击后台设置->LOG 设置,全打勾
修改gradle命令的执行环境。一般命令行打包会出现这个问题。
修改gradle.properties,
添加org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home
参考
需要注意正则要使用空格来隔开,这边发现没有空格会有问题
& 只需要空格
| 需要前后空格加 |
所以如果你想过滤自己的应用程序,使用
package:mine
如果还要在此基础上筛选出 A,则是
package:mine A
如果希望还要筛选出 B,则是
package:mine A | B
注意空格的使用,没有空格,比如下面,可能就什么都筛选不出来
package:mineA|B
just add the follow code in onCreate()
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
add codes as follows:
maven { url 'https://jitpack.io' }
// 阿里云镜像
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
change before:
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
after:
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven { url 'https://jitpack.io' }
//阿里云镜像
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
//阿里云镜像
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
}
}
Mac 解决方法(其他系统类似):
到官网下载 ninja文件
然后将这个文件拷贝到/usr/local/bin目录下
重新编译项目即可
参考链接:
External Native Build Issues: SIMPLE: Error configuring
除了可能是代码逻辑之外,还有可能是公司 Wi-Fi 问题,即网络问题
在 ~/.ssh/config 文件里面,增加
Host *
PubkeyAcceptedAlgorithms +ssh-rsa
HostkeyAlgorithms +ssh-rsa
看下依赖里面是否有下面依赖:
implementation("androidx.activity:activity-compose:1.7.0")
Android 10 使用 adb 进行无线调试时,发现想查询设备 ip 地址出现错误:
ifconfig: ioctl 8927: Permission denied
可以改用如下命令:
ip -f inet addr show
获取
javac YOUR_CLASS_FILE_NAME.java -h .
Ref:https://stackoverflow.com/questions/19137201/javah-tool-error-could-not-find-class-file-for-hellojni
There are some bug when we build android project with gradle, now give some solutions follow.
Q1:
ProGuard, version 5.2.1
Reading input...
Execution failed for task 'project:transformClassesAndResourcesWithProguardForRelease'.
java.io.IOException: Please correct the above warnings first.
A1:
disable the ProGuard first.
check you module build.gradle, make the minifyEnabled's value to be false.
minifyEnabled false
Q2:
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: aidl is missing
A2:
it means you compileSdkVersion and buildToolsVersion is not very fit.
I am use 25 and 25.0.0 and get this error.Then I instead of 23 and 23.0.2.And this error is solve.
Q3:
Caused by: org.gradle.api.InvalidUserDataException: File 'project/module/build/intermediates/res/
resources-release-stripped.ap_' specified for property 'resourceFile' does not exist.
A3:
set shrinkResources's value to be false
shrinkResources false
Q4:
Caused by: org.gradle.api.GradleException: Buildtools 25.0.0 requires Java 1.8 or above. Current JDK version is 1.7.
or other show your jdk is not fit
A4:
in jenkins,change the task from
assemble --stacktrace
to
assemble --stacktrace -Dorg.gradle.java.home='yourjdkhome'
Q5:
Caused by: java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
A5:
check your gradle version and jdk version.mostly it's your jdk version.You can try the Q4 solution and see whether it solve or not.
try add compileOptions or modify like follow
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.