I have looked at this article
[INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]
But i was unable to get any resolution.
right now this is my code.
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.example.testapp.testapp"
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
splits {
abi {
enable true
reset()
include 'arm64-v8a'
universalApk true
}
}
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:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation('me.dm7.barcodescanner:zxing:1.9') { exclude module: 'support-v4' }
implementation 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
implementation 'org.bitcoinj:bitcoinj-core:0.14.7'
api 'org.slf4j:slf4j-api:1.7.25'
implementation 'org.slf4j:slf4j-simple:1.7.12'
}
And also my mainactivity
public class MainPage extends AppCompatActivity {
public static NetworkParameters BTCparams = TestNet3Params.get();
public static WalletAppKit BTCkit = new WalletAppKit(BTCparams,new File("."),"BTC-Test");
static String[] account;
static String[] server;
private Handler handler = new Handler();
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tVBTCPer = (TextView)findViewById(R.id.tVBTCPer);
TextView tVNull = (TextView)findViewById(R.id.tVNull);
tVNull.setText(System.getProperty("os.arch"));
DownloadProgressTracker BTCListener = new DownloadProgressTracker() {
#Override
public void progress(double pct, int blocksSoFar, Date date) {
tVBTCPer.setText((int) pct+"%");
}
#Override
public void doneDownload() {
tVBTCPer.setText("100%");
}
};
BTCkit.setDownloadListener(BTCListener).setBlockingStartup(false).startAsync().awaitRunning();
}
I used this library to make java applications for pc/linux and it works fine. But when im trying to compile this for android to be usable it gets hung up trying to install the apk onto my device.
my os.arch is aarch64. I also have a previous post in stackoverflow to help give it some context.
Bitcoinj library on android hung on installing APK
I am not entirely sure what library i would need to help this apk install onto my device.
Related
Did anyone encounter the same issue? When using Dokka to document a data class
/**
* Data class for which we want documentation
*/
data class DokkaData(
/** A String value */
val aString: String,
/** An Integer value */
val anInt: Int,
/** Yes, a Boolean value. My favorite. */
val aBoolean: Boolean) {
/**
* Checks that all values are representation of `1`
*/
fun isOne() = aString == "1" && anInt == 1 && aBoolean
}
the documentation is correctly displayed in Android Studio
But then, when exporting library to mavenLocal using dokkaJavadoc:
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'maven-publish'
id("org.jetbrains.dokka") version "1.6.10"
}
android {
compileSdk 31
defaultConfig {
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
task dokkaJavadocJar(type: Jar, dependsOn: dokkaJavadoc) {
archiveClassifier.set("javadoc")
from dokkaJavadoc.outputDirectory
}
publishing {
publications {
release(MavenPublication) {
groupId = "com.dokkatests.testlib"
artifactId = "lib"
version = "2.1-dataDoc"
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact(dokkaJavadocJar)
}
}
}
the generated library javadoc is correctly displayed for methods, but not for the data class level
Note: The html documentation is complete, the issue is only for the documentation displayed in Android Studio. I didn't find any other reference to this issue, which is strange because it looks like a blocker to me.
Any clue?
Move KDoc comments of property of data class to be at class level and use #property or #param
example
I'm experimenting with getting the Android Advertising Id, but I can't find the proper way. In fact, I can't even get the Advertising Id Provider.
isAdvertisingIdProviderAvailable( ) always returns false. I'm using a Samsung with 8.0 + PlayStore and also on the emulator with 8.1 + Google Play, running as a debug build.
I've followed this guide:
https://developer.android.com/training/articles/ad-id
This must be something simple, but I can't see it.
Thanks for any suggestions.
I created a blank project and this is my code:
public class MainActivity extends AppCompatActivity {
public static final String TAG="MYTAG";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
boolean isProvider = AdvertisingIdClient.isAdvertisingIdProviderAvailable(getApplicationContext());
Log.i(TAG, "isProviderAvailable:" + isProvider);
}
}
Gradle:
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "company.com.adidviewer"
minSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.gms:play-services-ads:18.3.0'
implementation 'androidx.ads:ads-identifier:1.0.0-alpha04'
//implementation 'androidx.ads:ads-identifier-common:1.0.0-alpha04'
//implementation 'androidx.ads:ads-identifier-provider:1.0.0-alpha04'
// Used for the calls to addCallback() in the snippets on this page.
//implementation 'com.google.guava:guava:28.0-android'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
Manifest
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true"/>
</application>
If you want to get the advertising id for your published app, use the following approach:
Add this line to your gradle file;
com.google.android.gms:play-services-ads-identifier:16.0.0
And the code like this;
private void determineAdvertisingInfo(Context context) {
AsyncTask.execute(new Runnable() {
#Override
public void run() {
try {
AdvertisingIdClient.Info advertisingIdInfo = AdvertisingIdClient.getAdvertisingIdInfo(context);
// You should check this in case the user disabled it from settings
if (!advertisingIdInfo.isLimitAdTrackingEnabled()) {
String id = advertisingIdInfo.getId();
// getUserAttributes(id);
} else {
//If you stored the id you should remove it
}
} catch (IOException | GooglePlayServicesNotAvailableException | GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
}
});
}
There is a note specifying this in the document as well:
Note
i want to implement Google Tag Manager in android app so i set followwing code
public class MainActivity extends Activity {
private static final String CONTAINER_ID = "GTM-YYYY";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TagManager tagManager = TagManager.getInstance(this);
tagManager.setVerboseLoggingEnabled(true);
PendingResult<ContainerHolder> pending =
tagManager.loadContainerPreferNonDefault(CONTAINER_ID,
R.raw.gtm_default_container);
pending.setResultCallback(new ResultCallback<ContainerHolder>() {
#Override
public void onResult(ContainerHolder containerHolder) {
ContainerHolderSingleton.setContainerHolder(containerHolder);
Container container = containerHolder.getContainer();
if (!containerHolder.getStatus().isSuccess()) {
Log.e("CuteAnimals", "failure loading container");
displayErrorToUser(R.string.load_error);
return;
}
ContainerHolderSingleton.setContainerHolder(containerHolder);
ContainerLoadedCallback.registerCallbacksForContainer(container);
containerHolder.setContainerAvailableListener(new ContainerLoadedCallback());
startMainActivity();
}
}, 2, TimeUnit.SECONDS);
}
}
i also set google play library in my gradle file as below
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "pkg.android.demo"
minSdkVersion 15
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.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
}
When i put above code ContainerLoadedCallback clas not found as below image
Any idea how can i solve this?
This methods are from example. You have to implement them by yourself if you want.
You can also comment // them and it will work fine. Remove lines with errors.
This classes are shown here to show what can you do with your container.
You can find these classes in the cuteanimal sample. Go to your directory where sdk is located..... /extras/google/google_play_services/tagmanager/cuteanimals
I am trying to exchange files between watch and handheld by using the channel API.
But when I tried to open the channel by calling the following code, the ChannelAPI can not be resolved . Its not part of the "wearable" class I am using.
I guess there probably was caused by the wrong Android version. Does anyone know which version should I specify in my config files or how to fix it?
Thanks a lot.
My wear bundle file looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "mywearapp"
minSdkVersion 20
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4096m"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:1.1.0'
compile 'com.google.android.gms:play-services-wearable:7.8.0'
compile project(':shared')
}
Wearable.ChannelApi.openChannel(
mGoogleApiClient, node.getId(), "/mypath").setResultCallback(
new ResultCallback<ChannelApi.OpenChannelResult>() {
#Override
public void onResult(ChannelApi.OpenChannelResult openChannelResult) {
if (openChannelResult.getStatus().isSuccess()) {
mChannel = openChannelResult.getChannel();
mChannel.getOutputStream(mGoogleApiClient).setResultCallback(
new ResultCallback<Channel.GetOutputStreamResult>() {
#Override
public void onResult(Channel.GetOutputStreamResult getOutputStreamResult) {
if (getOutputStreamResult.getStatus().isSuccess()) {
mOutputStream = getOutputStreamResult.getOutputStream();
} else {
// handle failure, and close channel
}
}
});
}
}
});
I'm having trouble referencing a groovy class i've created. Here are the steps:
my build.gradle file has all required dependencies:
apply plugin: 'com.android.application'
apply plugin: 'groovyx.grooid.groovy-android'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
packagingOptions {
// workaround for http://stackoverflow.com/questions/20673625/android-gradle-plugin-0-7-0-duplicate-files-during-packaging-of-apk
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/groovy-release-info.properties'
}
defaultConfig {
applicationId "com.example.uen.myrxjavaandroidproject"
minSdkVersion 17
targetSdkVersion 22
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:22.2.0'
compile 'com.netflix.rxjava:rxjava-android:0.20.7'
compile 'com.squareup:otto:1.3.5'
compile 'org.codehaus.groovy:groovy:2.4.3:grooid'
}
And gradle is synched successfully.
then i created a folder under main called 'groovy' such that my project structure looks like the following:
notice i have a groovy class called "Hello", it looks like this:
public class Hello {
String name;
public void sayHello() {
System.out.println("Hello "+getName()+"!");
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
now in my MainActivity.java class i try to instantiate Hello class but its not being recognized. I am doing this:
Hello myHello = new Hello();
what am i doing wrong ?
If you want to use a Groovy class from your Java sources, then your Java file must be found in the "groovy" directory. It's done this way to enforce joint compilation (Java classes consuming Groovy classes or the other way).
And independently of this, for the sake of Grooviness, your Hello Groovy class can be reduced to:
class Hello {
String name
void sayHello() {
println "Hello $name!"
}
}