Implementing hide api for android 30 in project - java

I decompiled fmradio app for xiaomi. For using hidden api i copyd and replaced android.jar file from https://drive.google.com/drive/folders/185jgOthBI_qXzeS14s795LMGSekSTw5_. I have gradles:
#project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.3.0' apply false
id 'com.android.library' version '7.3.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
#module
plugins {
id 'com.android.application'
}
android {
applicationVariants.all { variant ->
//variant.packageApplicationProvider.get().outputDirectory = new File(project.getRootDir().absolutePath + "/" + variant.buildType.name + "/")
variant.outputs.all { output ->
output.outputFileName = "FMRadio" + (variant.buildType.name.toLowerCase().contains("release") ? "" : "-" + variant.buildType.name) + ".apk"
}
}
signingConfigs {
release {
def f = file("../local.properties")
if (f.exists()) {
def props = new Properties()
f.withInputStream { props.load(it) }
storeFile file(props.RELEASE_KEY_PATH)
storePassword props.RELEASE_STORE_PASSWORD
keyAlias props.RELEASE_KEY_ALIAS
keyPassword props.RELEASE_KEY_PASSWORD
} else {
def writer = new FileWriter(f.path)
writer.write("RELEASE_KEY_PATH=\n")
writer.write("RELEASE_KEY_PASSWORD=\n")
writer.write("RELEASE_KEY_ALIAS=\n")
writer.write("RELEASE_STORE_PASSWORD=")
writer.close()
throw new IOException("File $f.name was created. please fill it by values of your release key.")
}
}
}
compileSdkVersion 30
buildToolsVersion "33.0.0"
defaultConfig {
applicationId 'com.miui.fmservice'
minSdkVersion 30
targetSdkVersion 31
versionCode 30
versionName "11"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
lintOptions {
abortOnError false
checkReleaseBuilds false
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.fragment:fragment:1.5.3'
}
But after trying to sync project with gradle files i get a large error stack trace,which you can find at https://pastebin.com/PfeN1viv. Help me please why this error happens. May be in android 30 i can't use hidden api? Thanks everybody for any help.

Related

Error:Plugin with id 'kotlin-android' not found. on android studio

I get this error when I add this to Android Studio
"Error:Plugin with id 'kotlin-android' not found.".
I am trying to install opencv on my android, but it will not work.
I made a new project in my Android that is empty but works
My build gradle
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
def openCVersionName = "4.5.4"
def openCVersionCode = ((4 * 100 + 5) * 100 + 4) * 10 + 0
println "OpenCV: " +openCVersionName + " " + project.buildscript.sourceFile
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 21
targetSdkVersion 26
versionCode openCVersionCode
versionName openCVersionName
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_shared"
targets "opencv_jni_shared"
}
}
}
buildTypes {
debug {
packagingOptions {
doNotStrip '**/*.so' // controlled by OpenCV CMake scripts
}
}
release {
packagingOptions {
doNotStrip '**/*.so' // controlled by OpenCV CMake scripts
}
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets {
main {
jniLibs.srcDirs = ['native/libs']
java.srcDirs = ['java/src']
aidl.srcDirs = ['java/src']
res.srcDirs = ['java/res']
manifest.srcFile 'java/AndroidManifest.xml'
}
}
externalNativeBuild {
cmake {
path (project.projectDir.toString() + '/libcxx_helper/CMakeLists.txt')
}
}
}
dependencies {
}
I ran into the same error with Android Studio 2020.3.1 and fixed the error by adding this on top of the skd's build gradle (above 'apply plugin...'):
buildscript {
ext {
kotlinVersion = "1.4.0"
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
repositories {
mavenCentral()
}
}

android - Program type already present: android.support.multidex.ZipUtil$CentralDirectory

I use the following way for adding the multidex in my project but i come across with the following error
Error: Program type already present:
android.support.multidex.ZipUtil$CentralDirectory
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.example.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 3
versionName "1.0.7"
vectorDrawables.useSupportLibrary = true
vectorDrawables {
useSupportLibrary = true
}
multiDexEnabled true
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "12g"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:' + rootProject.ext.supportLibraryVersion
implementation 'com.android.support:support-v4:' + rootProject.ext.supportLibraryVersion
implementation 'com.android.support:design:' + rootProject.ext.supportLibraryVersion
implementation 'com.android.support:cardview-v7:' + rootProject.ext.supportLibraryVersion
implementation 'com.android.support:recyclerview-v7:' + rootProject.ext.supportLibraryVersion
implementation 'dev.dworks.libs:volleyplus:+'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.multidex:multidex:2.0.0'
......
}
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = []
}
dx.additionalParameters += '--multi-dex' // enable multidex
// optional
dx.additionalParameters += "--main-dex-list=$projectDir/multidex.keep".toString()
}
}
ext {
compileSdkVersion = 28
buildToolsVersion = "28.0.2"
minSdkVersion =19
targetSdkVersion = 28
supportLibraryVersion = '26.0.0-alpha1'
}
multidex.keep
android/support/multidex/BuildConfig/class
android/support/multidex/MultiDex$V14/class
android/support/multidex/MultiDex$V19/class
android/support/multidex/MultiDex$V4/class
android/support/multidex/MultiDex/class
android/support/multidex/MultiDexApplication/class
android/support/multidex/MultiDexExtractor$1/class
android/support/multidex/MultiDexExtractor/class
android/support/multidex/ZipUtil$CentralDirectory/class
android/support/multidex/ZipUtil/class
AppController.java
public class AppController extends Application {
#Override
public void onCreate() {
super.onCreate();
MultiDex.install(this);
}
}
can anyone help me
thanks
If you are using Android studio to build project.
Please run from menu
Build-> Clean Project
And than rebuild the project
I was getting the such error with other libraries. It got solved by using the above mentioned steps.

Could not get unknown property 'resolutionStrategy' for project ':app' of type org.gradle.api.Project

I was getting this error:
Error:Execution failed for task ':app:preDebugBuild'.
Android dependency 'com.android.support:appcompat-v7' has different version for the compile (25.3.1) and runtime (27.1.0) classpath. You should manually set the same version via DependencyResolution
A quick search on google showed me that I should include in my app/build.gradle:
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "25.3.1"
}
}
Now I get a new error:
Could not get unknown property 'resolutionStrategy' for project ':app' of type org.gradle.api.Project.
here is my full app/build.gradle code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
dexOptions {
preDexLibraries = false
}
defaultConfig {
applicationId "co.test.Test"
minSdkVersion 26
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dirs 'libs'
maven { url "http://dl.bintray.com/chat-sdk/chat-sdk-android" }
google()
maven { url "https://jitpack.io" }
mavenLocal()
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':library')
implementation 'co.chatsdk.chatsdk:chat-sdk-core:4.0.8'
implementation 'co.chatsdk.chatsdk:chat-sdk-ui:4.0.8'
implementation 'co.chatsdk.chatsdk:chat-sdk-firebase-adapter:4.0.8'
implementation 'co.chatsdk.chatsdk:chat-sdk-firebase-file-storage:4.0.8'
}
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "25.3.1"
}
}
apply plugin: 'com.google.gms.google-services'
my library/build.gradle:
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation files('libs/aacdecoder-android-0.8.jar')
}

Error:(18, 0) Gradle DSL method not found: 'android()' compile

I am new to Android and Android Studio so, I downloaded a project that I also need for my class then I got this error. I could not find my answer here, although there was a question like mine. Please help me to run this program that I downloaded from internet and solve this error, thank you.
These are my gradles:
apply plugin: 'com.android.application'
android {
compileSdkVersion 17
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.gettaxi"
minSdkVersion 8
targetSdkVersion 17
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
}
And:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}
allprojects {
repositories {
jcenter()
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.stackoverflow.answer"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
androidTestCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
}

File not found while trying to compile Telegram source code

I am trying to build an app like Telegram.I downloaded their source code (https://github.com/DrKLO/Telegram) (for Android).
My main problem is that,when I try to compile the code and export it to my mobile phone,using Android Studio I recive this error:
Error:A problem was found with the configuration of task ':TMessagesProj:packageDebug'.
File 'C:\Users\Bogdan\Desktop\Telegram\Telegram-master\TMessagesProj\config\debug.keystore' specified for property 'signingConfig.storeFile' does not exist.
Obviously a file is missing,but which,and how can I solve this problem?
Thank you!
P.S. Can you please provide me with a link to the source code of an app similar like this one,or similar to whatsapp?
Change Telegram/TMessagesProj/build.gradle and remove or comment signing option in gradle config, like this:
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:22.2.+'
compile 'com.google.android.gms:play-services:3.2.+'
compile 'net.hockeyapp.android:HockeySDK:3.5.+'
compile 'com.googlecode.mp4parser:isoparser:1.0.+'
}
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
/**
signingConfigs {
debug {
storeFile file("config/debug.keystore")
}
release {
storeFile file("config/release.keystore")
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
*/
buildTypes {
debug {
debuggable true
jniDebuggable true
// signingConfig signingConfigs.debug
}
release {
debuggable false
jniDebuggable false
//signingConfig signingConfigs.release
}
foss {
debuggable false
jniDebuggable false
// signingConfig signingConfigs.release
}
}
sourceSets.main {
jniLibs.srcDir 'libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
sourceSets.debug {
manifest.srcFile 'config/debug/AndroidManifest.xml'
}
sourceSets.release {
manifest.srcFile 'config/release/AndroidManifest.xml'
}
sourceSets.foss {
manifest.srcFile 'config/foss/AndroidManifest.xml'
}
defaultConfig {
minSdkVersion 8
targetSdkVersion 22
versionCode 572
versionName "3.0.1"
}
}

Categories

Resources