gradlew build --warning-mode all --info
gradlew clean build --stacktrace
gradlew build
gradlew build -Xlint:deprecation
gradlew assembleRelease
gradlew build --warning-mode all
./gradlew debugBuild --scan
banner_ad_unit_id
build.gradle (project-level)
Add Firebase Gradle buildscript dependency
classpath 'com.google.gms:google-services:3.2.1'
app/build.gradle
Add Firebase plugin for Gradle
apply plugin: 'com.google.gms.google-services'
======================================================================
apply plugin: 'com.android.application'
android {
lintOptions{
disable 'MissingTranslation'
}
signingConfigs {
// config {
// keyAlias 'isaidit'
// keyPassword 'isaidit'
// storeFile file('../keystore/1016_isaidit.key')
// storePassword 'isaidit'
// }
config {
keyAlias 'origami'
keyPassword '@!sfuQ123zpc'
storeFile file('D:/walhalla/keystore.jks')
storePassword '@!sfuQ123zpc'
}
}
compileSdkVersion 27
buildToolsVersion '28.0.2'
defaultConfig {
applicationId "com.walhalla.pocketinstructor"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName versionCode + "-" + getTimestamp()
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
// Enabling multidex support.
multiDexEnabled false
}
buildTypes {
debug {
multiDexEnabled false
debuggable true
jniDebuggable true
minifyEnabled false
}
release {
minifyEnabled true
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//best obfuscation -> -optimize
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
debuggable false
jniDebuggable false
signingConfig signingConfigs.config
renderscriptDebuggable false
pseudoLocalesEnabled true
// applicationIdSuffix '.a'
versionNameSuffix 'b'
// zipAlignEnabled true
// Enabling multidex support.
multiDexEnabled false
}
}
flavorDimensions 'W'
productFlavors {
googleplay {
//versionName = "gp"
project.ext.set("archivesBaseName", "gp-" + defaultConfig.versionName);
flavorDimensions 'W'
resValue 'string', 'market_rate_url', 'market://details?id=%1$s'
}
amazon {
//versionName = "a"
project.ext.set("archivesBaseName", "a-" + defaultConfig.versionName);
flavorDimensions 'W'
resValue 'string', 'market_rate_url', 'http://www.amazon.com/gp/mas/dl/android?p=%1$s'
}
}
dexOptions {
preDexLibraries = false
//fail>javaMaxHeapSize "2g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
def FOO = '27.1.1'
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "com.android.support:appcompat-v7:$FOO"
implementation "com.android.support:design:$FOO"
implementation('uk.co.chrisjenx:calligraphy:2.2.0') {
exclude group: 'com.android.support', module: 'support-v4'
}
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.jakewharton:butterknife:8.6.0'
// implementation('com.google.android.gms:play-services-ads:15.0.1') {
// exclude group: 'com.android.support'
// }
implementation("com.google.firebase:firebase-ads:15.0.1") {
exclude group: 'com.android.support'
}
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.arello-mobile:moxy-app-compat:1.5.3'
implementation 'com.arello-mobile:moxy:1.5.3'
implementation 'com.github.bumptech.glide:glide:4.3.1'
testImplementation 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
annotationProcessor 'com.arello-mobile:moxy-compiler:1.5.3'
implementation 'com.google.dagger:dagger:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
implementation('com.github.piasy:BigImageViewer:1.4.0') {
exclude group: 'com.android.support', module: 'support-v4'
}
// load with glide
// implementation 'com.github.piasy:GlideImageLoader:1.4.0'
//
// // progress pie indicator
// implementation 'com.github.piasy:ProgressPieIndicator:1.4.0'
//@ implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0';
//Themes
implementation 'com.52inc:scoops:1.0.0'
implementation project(':ui')
implementation project(':wads')
}
static def getTimestamp() {
def date = new Date()
return date.format('yyyyMMdd.HHmm')
}
//implementation files('../libs/game_lib.jar')
@@@@@@@@@@@@@ ROOM @@@@@@@@@@@@@
implementation "android.arch.persistence.room:runtime:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-rc03'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
==============================================================================s
=============
FreeOpenVPN.Org config fil
MultiDex -> 65536
android{
useLibrary 'org.apache.http.legacy'
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
@dependency{
compile 'com.android.volley:volley:1.1.0'
}
-encoding UTF-8 -docencoding utf-8 -charset utf-8
gradlew assembleDebug --stacktrace
gradlew assembleDebug --stacktrace
gradlew clean
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=
implementation("com.google.firebase:firebase-ads:${GOO}") {
exclude group: 'com.android.support'
}
implementation ('com.google.android.gms:play-services-ads:15.0.1') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
C:\Users\combo\.gradle\wrapper\dists
./gradlew wrapper --gradle-version=4.1 --distribution-type=bin
-Xmx768m
gradlew -info
gradlew -stacktrace
gradlew app:dependencies //<----------------------------------------------------------------
gradlew clean
gradlew -q dependencies app:dependencies --configuration implementation #Просмотр
gradlew -q dependencies
зависимостей
мастер оф паппетс
================================================================================================
gradlew htmlDependencyReport
gradlew app:dependencies @@@@@@@@@@@@@@@@@@@@@@@@@@
gradlew app:dependencies @@@@@@@@@@@@@@@@@@@@@@@@@@
gradlew -q dependencies Bitrix:dependencies --configuration implementation
gradlew Bitrix:dependencies > 1.txt
gradlew -q dependencies app:dependencies --configuration implementation > 1.txt
gradlew :app:dependencies --configuration implementation > 1.txt
gradlew task ':app:transformClassesWithDexForDebug' --stacktrace
gradlew app:transformClassesWithDexForRelease --stacktrace
gradlew task
gradlew --help task
gradlew --help task --all
gradlew task ':app:compile' -Xlint:deprecation
gradlew task ':app:compile' --stacktrace
gradlew task ':app:processDebugGoogleServices' --stacktrace
gradle wrapper
With gradle 2.4 (or higher) you can set up a wrapper without adding a dedicated task:
gradle wrapper --gradle-version 2.3
./gradlew assembleRelease
gradlew :app:assembleDebug --stacktrace -Xlint
===================================
BASE APP
===================================
//di
compile 'com.google.dagger:dagger:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
=============================================================================
include ':FragmentNavigator'
project(':FragmentNavigator').projectDir = new File(settingsDir, '../../Libraries/FragmentNavigator/library')
include ':app'
include ':mcsoxford_rss'
project(':mcsoxford_rss').projectDir = new File('C:\\android\\ANDROID_TUTORIAL\\$Modules\\android-rss')
compile project(path: ':FragmentNavigator')
----------------
Gradle library
----------------
build.gradle
apply plugin: 'java'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
----------
build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 23 buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 14 targetSdkVersion 23 versionCode 1 versionName "1.0" }
buildTypes {
release {
minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'}
settings.gradle
include ':app', ':lib', ':mylibrary' //Include library
local.properties
ndk.dir=D\:\\Android\\AndroidSDK\\ndk-bundlesdk.dir=D\:\\Android\\AndroidSDK
================================================================
apply from: 'C:\\android\\versions.gradle'
android {
compileSdkVersion versionCompile
buildToolsVersion versionBuildTool
...
minSdkVersion versionMin
targetSdkVersion versionTarget
${versionSupportLib}
compile "com.android.support:design:${versionSupportLib}"
compile "com.android.support:palette-v7:${versionSupportLib}"
compile "com.android.support:cardview-v7:${versionSupportLib}"
=====================
project build.gradle
ext{
versionCompile = 26
versionBuildTool = '26.0.0 rc2'
versionMin = 15
versionTarget = 26
versionSupportLib = '26.0.0-alpha1'
okhttpVersion = '3.4.1'
retrofitVersion = '2.1.0'
rxandroidVersion = '1.2.1'
rxjavaVersion = '1.1.10'
rxLoaderVersion = '0.1.2'
butterKnifeVersion = '8.3.0'
hawkVersion = '1.23'
junitVersion = '4.12'
mockitoVersion = '1.10.19'
powerMockVersion = '1.6.5'
robolectricVersion = '3.1.2'
}
build.gradle
-- core
apply plugin: 'java'
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.google.code.findbugs:findbugs:3.0.1'
}
gradle.properties
# org.gradle.parallel=true
org.gradle.jvmargs=-Xmx1024m
gradlew build --stacktrace > logs.txt 2>logErrors.txt
Ubuntu
sudo apt update
sudo apt install wget curl
sudo apt install openjdk-11-jdk
@@
wget https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2024.1.2.13/android-studio-2024.1.2.13-linux.tar.gz
@@
tar -xzvf android-studio-*.tar.gz
sudo mv android-studio /opt/
/opt/android-studio/bin/studio.sh
sudo nano /usr/share/applications/android-studio.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio
Exec=/opt/android-studio/bin/studio.sh
Icon=/opt/android-studio/bin/studio.png
Comment=Android IDE
Categories=Development;IDE;
Terminal=false
===
sudo apt install openjdk-11-jdk
wget https://github.com/skylot/jadx/releases/download/v1.5.0/jadx-1.5.0.zip
unzip jadx-gui-*.zip -d jadx-gui
@@@
cd jadx-gui
./bin/jadx-gui
sssssss
sudo nano /usr/share/applications/jadx-gui.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Jadx GUI
Exec=/path/to/jadx-gui/bin/jadx-gui
Icon=/path/to/jadx-gui/icon.png
Comment=Android APK decompiler
Categories=Development;
Terminal=false
sudo apt update
sudo apt install firefox
sudo apt upgrade firefox
=======
nano ~/.bashrc
Вставьте в конец файла следующую строку:
export ANDROID_HOME=$HOME/.........{*****}
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
Примените изменения: Выполните команду, чтобы изменения вступили в силу:
source ~/.bashrc ==========sudo apt update
sudo apt install snapd
sudo snap install obsidian --classic
C:\Users\combo\.gradle\gradle.properties
nano ~/.gradle/gradle.properties
analyticsVersion=22.1.0
android.suppressUnsupportedCompileSdk=34,33,35
compatVersion=1.7.0
crashlyticsVersion=19.2.0
firebaseDatabase=21.0.0
gmsAds=23.4.0
javaVersion=17
lifecycle_version=2.8.6
materialVersion=1.12.0
minSdkVersion0=21
roomVersion=2.6.1
targetSdkVersion0=35
mediaVersion=1.0.0-alpha03
firestore=25.0.0
glideVersion=4.16.0
compileSdk0=35
buildToolsVersion0=35.0.0
constraintVersion=2.1.4
OneSignal=5.1.21
recyclerViewVersion=1.3.1
cardViewVersion=1.0.0
gridLayoutVersion=1.0.0
ADB Android
adb shell pm list packages
adb shell pm dump com.zhiliaoapp.musically | C:\msys64\usr\bin\grep.exe Instrumentation
adb shell pm dump com.zhiliaoapp.musically | C:\msys64\usr\bin\grep.exe "android.intent.action.SEND"
adb shell dumpsys window windows > aaaaa.txt
Getting the name of the current activity via ADB
adb shell "dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'"adb shell "dumpsys activity activities | grep ResumedActivity"adb shell dumpsys package video.like
=========
adb shell input tap 601 1450
adb shell input tap 117 1389
adb backup -apk -all -shared -f adb.ab
adb -s emulator-5554 shell
adb -s 2624294010LA15CC shell
RE5887:/ $ settings put global verifier_verify_adb_installs 0
========
adb shell monkey -p your.app.package.name -c android.intent.category.LAUNCHER 1
com.google.android.contacts
adb root
adb shell su -c "radiooptions 8 4485799"
adb -s <serialno> shell am start -a android.intent.action.CALL -d tel:<PHONE_NUMBER>
adb shell dumpsys batterystats --charged <package-name>
adb shell pm list packages -s
adb shell am start -a android.intent.action.CALL -d tel:+<PHONE_NUMBER>
adb shell am start -a android.intent.action.SENDTO -d sms:+<PHONE_NUMBER> --es sms_body "Test Message from Technastic.com"
Cordova build App Sdk 34
When building, file _PROJECT_\config.xml will be copied to:
_PROJECT_\platforms\android\app\src\main\res\xml\config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget xmlns:cdv="http://cordova.apache.org/ns/1.0" id="com.example" version="1.0.5"
xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android">
<name>titleTitle</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
<preference name="android-targetSdkVersion" value="34" />
<preference name="android-minSdkVersion" value="23" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi"
src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi"
src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi"
src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi"
src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi"
src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi"
src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge"
target="/manifest/application/activity">
<activity android:exported="true" />
</edit-config>
</widget>
=====================
Optional
=====================
<edit-config file="app/src/main/AndroidManifest.xml" target="/manifest/application/service" mode="merge">
<service android:exported="true" />
</edit-config>
<edit-config file="app/src/main/AndroidManifest.xml" target="/manifest/application/receiver" mode="merge">
<receiver android:exported="true" />
</edit-config>
<edit-config file="app/src/main/AndroidManifest.xml" target="/manifest/application/provider" mode="merge">
<provider android:exported="true" />
</edit-config>
НЕ ИСПОЛЬЗОВАТЬ
<edit-config file="app/src/main/AndroidManifest.xml" target="/manifest/application/provider" mode="merge">
<provider android:exported="true" />
</edit-config>
Caused by: java.lang.SecurityException: Provider must not be exported
at android.support.v4.content.FileProvider.attachInfo(FileProvider.java:385)
<edit-config file="app/src/main/AndroidManifest.xml" target="/manifest/application/provider" mode="merge">
<provider android:exported="false" />
</edit-config>
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
`C:\Program Files (x86)\Common Files\Oracle\Java\javapath` - это путь к каталогу, который содержит символические ссылки на исполняемые файлы Java (например, `java.exe`, `javac.exe`, и т. д.). Этот путь обычно добавляется в переменную среды `PATH` при установке Java на компьютер.
Использование символических ссылок позволяет разработчикам и пользователям использовать Java без явного указания пути к исполняемым файлам. Вместо этого они могут вызывать команды Java, такие как `java` или `javac`, прямо из командной строки или сценария, и операционная система будет знать, где найти соответствующие исполняемые файлы.
Кроме того, путь `javapath` обычно указывает на каталог установки Java Runtime Environment (JRE) или Java Development Kit (JDK), которые могут использоваться различными приложениями или разработчиками для выполнения Java-кода.
========================================
two files missing in SDK build tool 31(and 34) that are:
- dx.bat
- dx.jar
The solution is that these files are named d8 in the file location so changing their name to dx will solve the error.
The steps are below.
For Windows
go to the location
"C:\Users\user\AppData\Local\Android\Sdk\build-tools\31.0.0"find a file named d8.bat. This is a Windows batch file.
rename d8.bat to dx.bat.
in the folder lib ("C:\Users\user\AppData\Local\Android\Sdk\build-tools\31.0.0\lib")
rename d8.jar to dx.jar
Remember AppData is a hidden folder. Turn on hidden items to see the AppData folder.
Internal error. Please refer to https://code.google.com/p/android/issues
java.util.concurrent.CompletionException: java.net.BindException: Address already in use: bind
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1702)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.BindException: Address already in use: bind
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:455)
at java.base/sun.nio.ch.Net.bind(Net.java:447)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:134)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:550)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:506)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:491)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:248)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:356)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
... 1 more
-----
JRE 11.0.8+10-b944.6842174 amd64 by N/A
C:\Program Files\Android\Android Studio\jre
netsh winsock reset
net stop winnat
net start winnat
Android Youtube API V3
{
"code" : 403,
"errors" : [ {
"domain" : "usageLimits",
"message" : "The request did not specify any Android package name or signing-certificate fingerprint. Please ensure that the client is sending them or use the API Console to update your key restrictions.",
"reason" : "ipRefererBlocked",
"extendedHelp" : "https://console.developers.google.com/apis/credentials?project=00000000000"
} ],
"message" : "The request did not specify any Android package name or signing-certificate fingerprint. Please ensure that the client is sending them or use the API Console to update your key restrictions."
}
It looks like you want to access the YouTube API features that need credentials.
This code does not work for an unauthorized user.
YouTube.Search search = mService.search(); YouTube.Search.List request = search.list("id,snippet"); request.setOrder("date"); request.setType("video"); request.setFields("nextPageToken,pageInfo(totalResults),items(id(videoId),snippet(title,description,thumbnails,publishedAt))"); request.setKey(m.getString(R.string.google_api_key)); request.setChannelId("UCCZBv-FBNdxoE87xae9eC6g"); request.setPageToken(""); request.setMaxResults((long) 5); SearchListResponse response = request.execute();
You need to use GoogleAccountCredential
With an authorized request, this error occurs due to line
request.setKey(m.getString(R.string.google_api_key));//not work It needs to be deleted!
//Not set this options
--> setKey it's crash аuthorized request
@@@ //REMOVE THIS -->> request.setKey(m.getString(R.string.google_api_key));
Example
public class MainActivity extends Activity implements EasyPermissions.PermissionCallbacks { GoogleAccountCredential mCredential; private TextView mOutputText; private Button mCallApiButton; ProgressDialog mProgress; static final int REQUEST_ACCOUNT_PICKER = 1000; static final int REQUEST_AUTHORIZATION = 1001; static final int REQUEST_GOOGLE_PLAY_SERVICES = 1002; static final int REQUEST_PERMISSION_GET_ACCOUNTS = 1003; private static final String BUTTON_TEXT = "Call YouTube Data API"; private static final String PREF_ACCOUNT_NAME = "accountName"; private static final String[] SCOPES = {YouTubeScopes.YOUTUBE_READONLY}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout activityLayout = new LinearLayout(this); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); activityLayout.setLayoutParams(lp); activityLayout.setOrientation(LinearLayout.VERTICAL); activityLayout.setPadding(16, 16, 16, 16); ViewGroup.LayoutParams tlp = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); mCallApiButton = new Button(this); mCallApiButton.setText(BUTTON_TEXT); mCallApiButton.setOnClickListener(v -> { mCallApiButton.setEnabled(false); mOutputText.setText(""); getResultsFromApi(); mCallApiButton.setEnabled(true); }); activityLayout.addView(mCallApiButton); mOutputText = new TextView(this); mOutputText.setLayoutParams(tlp); mOutputText.setPadding(16, 16, 16, 16); mOutputText.setVerticalScrollBarEnabled(true); mOutputText.setMovementMethod(new ScrollingMovementMethod()); mOutputText.setText( "Click the \'" + BUTTON_TEXT + "\' button to test the API."); activityLayout.addView(mOutputText); mProgress = new ProgressDialog(this); mProgress.setMessage("Calling YouTube Data API ..."); setContentView(activityLayout); // Initialize credentials and service object. mCredential = GoogleAccountCredential.usingOAuth2( getApplicationContext(), Arrays.asList(SCOPES)) .setBackOff(new ExponentialBackOff()); } /** * Attempt to call the API, after verifying that all the preconditions are * satisfied. The preconditions are: Google Play Services installed, an * account was selected and the device currently has online access. If any * of the preconditions are not satisfied, the app will prompt the user as * appropriate. */ private void getResultsFromApi() { if (!isGooglePlayServicesAvailable()) { acquireGooglePlayServices(); } else if (mCredential.getSelectedAccountName() == null) { chooseAccount(); } else if (!isDeviceOnline()) { mOutputText.setText("No network connection available."); } else { new MakeRequestTask(this, mCredential).execute(); } } /** * Attempts to set the account used with the API credentials. If an account * name was previously saved it will use that one; otherwise an account * picker dialog will be shown to the user. Note that the setting the * account to use with the credentials object requires the app to have the * GET_ACCOUNTS permission, which is requested here if it is not already * present. The AfterPermissionGranted annotation indicates that this * function will be rerun automatically whenever the GET_ACCOUNTS permission * is granted. */ @AfterPermissionGranted(REQUEST_PERMISSION_GET_ACCOUNTS) private void chooseAccount() { if (EasyPermissions.hasPermissions( this, Manifest.permission.GET_ACCOUNTS)) { String accountName = getPreferences(Context.MODE_PRIVATE) .getString(PREF_ACCOUNT_NAME, null); if (accountName != null) { mCredential.setSelectedAccountName(accountName); getResultsFromApi(); } else { // Start a dialog from which the user can choose an account startActivityForResult( mCredential.newChooseAccountIntent(), REQUEST_ACCOUNT_PICKER); } } else { // Request the GET_ACCOUNTS permission via a user dialog EasyPermissions.requestPermissions( this, "This app needs to access your Google account (via Contacts).", REQUEST_PERMISSION_GET_ACCOUNTS, Manifest.permission.GET_ACCOUNTS); } } /** * Called when an activity launched here (specifically, AccountPicker * and authorization) exits, giving you the requestCode you started it with, * the resultCode it returned, and any additional data from it. * * @param requestCode code indicating which activity result is incoming. * @param resultCode code indicating the result of the incoming * activity result. * @param data Intent (containing result data) returned by incoming * activity result. */ @Override protected void onActivityResult( int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case REQUEST_GOOGLE_PLAY_SERVICES: if (resultCode != RESULT_OK) { mOutputText.setText( "This app requires Google Play Services. Please install " + "Google Play Services on your device and relaunch this app."); } else { getResultsFromApi(); } break; case REQUEST_ACCOUNT_PICKER: if (resultCode == RESULT_OK && data != null && data.getExtras() != null) { String accountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME); if (accountName != null) { SharedPreferences settings = getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = settings.edit(); editor.putString(PREF_ACCOUNT_NAME, accountName); editor.apply(); mCredential.setSelectedAccountName(accountName); getResultsFromApi(); } } break; case REQUEST_AUTHORIZATION: if (resultCode == RESULT_OK) { getResultsFromApi(); } break; } } /** * Respond to requests for permissions at runtime for API 23 and above. * * @param requestCode The request code passed in * requestPermissions(android.app.Activity, String, int, String[]) * @param permissions The requested permissions. Never null. * @param grantResults The grant results for the corresponding permissions * which is either PERMISSION_GRANTED or PERMISSION_DENIED. Never null. */ @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); EasyPermissions.onRequestPermissionsResult( requestCode, permissions, grantResults, this); } /** * Callback for when a permission is granted using the EasyPermissions * library. * * @param requestCode The request code associated with the requested * permission * @param list The requested permission list. Never null. */ @Override public void onPermissionsGranted(int requestCode, List<String> list) { // Do nothing. } /** * Callback for when a permission is denied using the EasyPermissions * library. * * @param requestCode The request code associated with the requested * permission * @param list The requested permission list. Never null. */ @Override public void onPermissionsDenied(int requestCode, List<String> list) { // Do nothing. } /** * Checks whether the device currently has a network connection. * * @return true if the device has a network connection, false otherwise. */ private boolean isDeviceOnline() { ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); return (networkInfo != null && networkInfo.isConnected()); } /** * Check that Google Play services APK is installed and up to date. * * @return true if Google Play Services is available and up to * date on this device; false otherwise. */ private boolean isGooglePlayServicesAvailable() { GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); final int connectionStatusCode = apiAvailability.isGooglePlayServicesAvailable(this); return connectionStatusCode == ConnectionResult.SUCCESS; } /** * Attempt to resolve a missing, out-of-date, invalid or disabled Google * Play Services installation via a user dialog, if possible. */ private void acquireGooglePlayServices() { GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); final int connectionStatusCode = apiAvailability.isGooglePlayServicesAvailable(this); if (apiAvailability.isUserResolvableError(connectionStatusCode)) { showGooglePlayServicesAvailabilityErrorDialog(connectionStatusCode); } } /** * Display an error dialog showing that Google Play Services is missing * or out of date. * * @param connectionStatusCode code describing the presence (or lack of) * Google Play Services on this device. */ void showGooglePlayServicesAvailabilityErrorDialog( final int connectionStatusCode) { GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); Dialog dialog = apiAvailability.getErrorDialog( MainActivity.this, connectionStatusCode, REQUEST_GOOGLE_PLAY_SERVICES); dialog.show(); } private class MakeRequestTask extends AsyncTask<Void, Void, List<String>> { private final MainActivity m; private com.google.api.services.youtube.YouTube mService = null; private Exception mLastError = null; MakeRequestTask(MainActivity mainActivity, GoogleAccountCredential credential) { this.m = mainActivity; HttpTransport transport = AndroidHttp.newCompatibleTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); mService = new com.google.api.services.youtube.YouTube.Builder( transport, jsonFactory, credential) .setApplicationName(mainActivity.getString(R.string.app_name)) .build(); } /** * Background task to call YouTube Data API. * * @param params no parameters needed for this task. */ @Override protected List<String> doInBackground(Void... params) { try { return getDataFromApi(); } catch (Exception e) { mLastError = e; cancel(true); return null; } } /** * Fetch information about the "GoogleDevelopers" YouTube channel. * * @return List of Strings containing information about the channel. * @throws IOException */ private List<String> getDataFromApi() throws IOException { List<String> channelInfo = new ArrayList<String>(); YouTube.Search search = mService.search(); YouTube.Search.List request = search.list("id,snippet"); request.setOrder("date"); request.setType("video"); request.setFields("nextPageToken,pageInfo(totalResults),items(id(videoId),snippet(title,description,thumbnails,publishedAt))"); request.setChannelId("UCCZBv-FBNdxoE87xae9eC6g"); request.setPageToken(""); request.setMaxResults((long) 5); SearchListResponse response = request.execute(); if (response != null) { // Log.i(TAG, "run_yt_repo: "// +"https://www.googleapis.com/youtube/v3/search?part=snippet,id&order=date&\n" +// " type=video&\n" +// " fields=nextPageToken,pageInfo(totalResults),items(id(videoId),snippet(title,thumbnails,publishedAt))&\n" +// " key="+Const.DEVELOPER_KEY+"&\n" +// " channelId="+this.mChannelId+"&pageToken=&maxResults="+Const.VIDEO_LIMIT); List<SearchResult> mm = response.getItems(); if (mm != null) { channelInfo.add(mm.toString()); } } /** * ==================================================================== */ ChannelListResponse result = mService.channels().list("snippet,contentDetails,statistics") .setForUsername("GoogleDevelopers") .execute(); List<Channel> channels = result.getItems(); if (channels != null) { Channel channel = channels.get(0); channelInfo.add("This channel's ID is " + channel.getId() + ". " + "Its title is '" + channel.getSnippet().getTitle() + ", " + "and it has " + channel.getStatistics().getViewCount() + " views."); } return channelInfo; } @Override protected void onPreExecute() { m.mOutputText.setText(""); m.mProgress.show(); } @Override protected void onPostExecute(List<String> output) { m.mProgress.hide(); if (output == null || output.size() == 0) { m.mOutputText.setText("No results returned."); } else { output.add(0, "Data retrieved using the YouTube Data API:"); m.mOutputText.setText(TextUtils.join("\n", output)); } } @Override protected void onCancelled() { m.mProgress.hide(); if (mLastError != null) { if (mLastError instanceof GooglePlayServicesAvailabilityIOException) { m.showGooglePlayServicesAvailabilityErrorDialog( ((GooglePlayServicesAvailabilityIOException) mLastError) .getConnectionStatusCode()); } else if (mLastError instanceof UserRecoverableAuthIOException) { m.startActivityForResult( ((UserRecoverableAuthIOException) mLastError).getIntent(), MainActivity.REQUEST_AUTHORIZATION); } else { m.mOutputText.setText("The following error occurred:\n" + mLastError.getMessage()); } } else { m.mOutputText.setText("Request cancelled."); } } } private static final String TAG = "@@@"; }
Deprecated
import android.preference.PreferenceManager;
import androidx.preference.PreferenceManager;
implementation "androidx.preference:preference:1.0.0"
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.support.annotation.WorkerThread;
import androidx.annotation.WorkerThread;
Приложения в Google Play – MTProto List - Прокси для Telegram
Free Unlimited Proxy - Proxy MTProto for Telegram
================================================================================================
MTProto List for Telegram, using this program, you can communicate with servers
Telegram messenger, I use public proxies with MTProto cryptographic protocol.
To connect, you need to select a proxy from the program list and click on the "Connect" button,
the instant messenger will open automatically and will offer to confirm the selected proxy.
It is also necessary that the messenger was pre-installed and the version of the program was not outdated and supported work with the proxy.
Connecting through a proxy will increase your privacy, anonymity, security and preservation of information about personal correspondence, private data when working in the messenger.
Now you do not need to buy VPN provider services or alternative builds of Telegram clients with VPN support.
- Quick proxy selection for connection;
- One click connection;
- Small size application;
- Update proxy lists through Google Firebase services.
================================================================================================
MTProto List for Telegram, с помощью данной программы, вы сможете установить связь с серверами
мессенджера Telegram, использую публичные прокси с криптографическим протоколом MTProto.
Для подключения, нужно выбрать прокси из списка программы и нажать на кнопку "Connect",
автоматически откроется мессенджер телеграм, и предложит подтвердить выбранный прокси.
Также необходимо что-бы мессенджер был заранее установлен и версия программы не была устаревшей и поддерживала работу с прокси.
Подключение через прокси, повысит уровень вашей конфиденциальности, анонимности, безопасности и сохранении информации о личной переписке, приватных данных при работе в мессенджере.
Теперь не потребуется покупать услуги VPN провайдера или альтернативные сборки клиентов Telegram c поддержкой VPN.
- Быстрый выбор прокси для подключения;
- Подключение в один клик;
- Небольшой размер приложение;
- Обновление списков прокси через сервисы Google Firebase.
================================================================================================
MTProto List for Telegram, за допомогою даної програми, ви зможете встановити зв'язок з серверами
месенджера Telegram, використовую публічні проксі з криптографічним протоколом MTProto.
Для підключення, потрібно вибрати проксі зі списку програми і натиснути на кнопку "Connect",
автоматично відкриється месенджер телеграм, і запропонує підтвердити обраний проксі.
Також необхідно що-б месенджер був заздалегідь встановлений і версія програми не була застарілою і підтримувала роботу з проксі.
Підключення через проксі, підвищить рівень вашої конфіденційності, анонімності, безпеки і збереження інформації про особистому листуванні, приватних даних при роботі в месенджері.
Тепер не потрібно купувати послуги VPN провайдера або альтернативні збірки клієнтів Telegram c підтримкою VPN.
- Швидкий вибір проксі для підключення;
- Підключення в один клік;
- Невеликий розмір додаток;
- Оновлення списків проксі через сервіси Google Firebase.
================================================================================================
AndroidX Moxy Android Lib
//Dependencies
implementation('com.arello-mobile:moxy:1.5.6') {
transitive = false;
}
//Now I create a package and a class in the project.
java
---->android.support.v7.app.AppCompatActivity.java
package android.support.v7.app;
public class AppCompatActivity extends androidx.appcompat.app.AppCompatActivity {}
implementation("com.google.android.gms:play-services-ads:17.2.1") { exclude group: 'com.android.support'//<-----}
NDK BaseConfig.getApplicationIdSuffix()
classpath 'com.android.tools.build:gradle:3.2.0-rc03'
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Перехват трафика андроид /Charles Debug Proxy
Windows Proxy does not need to be activated
#----------------------------------------------------
adb reverse --no-rebind tcp:8814 tcp:8888
#
adb shell am start -a android.intent.action.VIEW -d http://chls.pro/ssl
#[https] Install certificat from SD card and set current wifi proxy settings 127.0.0.1:8814 (localhost:8814)
adb shell am start -a android.settings.SETTINGS
